How to Use the Php Include Function
Browse articles:
Auto Beauty Business Culture Dieting DIY Events Fashion Finance Food Freelancing Gardening Health Hobbies Home Internet Jobs Law Local Media Men's Health Mobile Nutrition Parenting Pets Pregnancy Products Psychology Real Estate Relationships Science Seniors Sports Technology Travel Wellness Women's Health
Browse companies:
Automotive Crafts & Gifts Department Stores Electronics Fashion Food & Drink Health & Beauty Home & Garden Online Services Sports & Outdoors Subscription Boxes Toys, Kids & Baby Travel & Events

How to Use the Php Include Function

Make your web development life a lot easier by using the php include function.

Before I discovered php (Hypertext Preprocessor) making simple changes to my Website was a long and tedious process. The simple act of adding a web page meant that I had to go to every existing page of my site and add the new page link to the menu. It was so time consuming that I would actually avoid adding pages or making changes for that reason. And then one day I discovered the php include function and my life got a whole lot easier. This is something that every webmaster should know and use no matter how large or small your site or your skill level.

php is a server-side scripting language for creating a dynamic and interactive Website. php can make life so much easier for anyone that builds or administers a Website. The larger your site the more you need php. Especially the php include function. With the php include function you can make changes to a single file, such as the navigation menu, without changing the coding of that file on each and every page. You simply make changes in the php include file and your done. You can make changes to this single file and the changes appear throughout your site. Another great thing about the php include function is that it can be used right along with your html. That's right, You can use php in an html document. Yipee!

To begin using php and the include function you first need to create a file in the root directory of your Website and name it include. Next create your file, in this case it will be the left-side-menu, and save it as a .php file in the include file you created it the root directory. Now, to call the include function, use this snippet <?php include ("include/left-side-menu.php"); ?> and place it in the html code of your Web page.

The code will look like this depending on where you want your menu on your page:

<div class="outline" id="left-side">

<?php include ("include/left-side-menu.php"); ?>


That's all there is to it. The php include function calls the entire menu file, no matter how large, and it only takes this one little snippet of code. Now that's great stuff. Give it a try and see just how much better your life gets.

Need an answer?
Get insightful answers from community-recommended
in Web Design & Development on Knoji.
Would you recommend this author as an expert in Web Design & Development?
You have 0 recommendations remaining to grant today.
Comments (0)