PHP include page statement is an extremely useful statement to build their websites . If you are very new to PHP or even do not know at all, you can also use this statement to manage your website . One can rightly divide the HTML of a web page into several segments. Some of them are static and others are variable parts. |
Static parts are those that do not change from one page to another , ie the top of the page where you put the site name and banner , menu, bottom of the page that gets copyright notice, etc. variable parts of the page are the elements that vary from page to page , ie the page title , description, keywords, page content , etc. When you create a new website that has to write all the HTML code for both static and variable parts of your page.
Now if you want to add a new link to the menu or if you want to change your website banner and you have to edit all HTML files that you have created. It is almost an impossible task if your website contains fifty pages or more. PHP include file is the ideal solution for this problem.
What is PHP include page?
PHP include statement adds the contents of the file to be included at the point where it gets this statement. This statement takes only one argument, the name of the file to include. The form of the statement is:
To include a file say menu.html use the following command:
If you have a text or HTML file, the contents of that file will be added directly to the main file at the point where you put the declaration of entry. But including a PHP file to include the file to include compiled and then added to the main file. If any errors generated during compilation of PHP will generate an error message.
How to use PHP include file?
To use the include file communicated to keep the static parts of your HTML code in separate files, for example menu.html, footer.html, top.html etc. For your convenience putting the files in a directory separate include. When creating a new website write your HTML code, as usual, but when you have to write the HTML code you just put static PHP include file to add these codes. So the resulting file is smaller and therefore easier to maintain. You can also edit the static part code by editing a single file.
Point to remember: You can use include to include HTML page or a PHP file, but the main file where you put the include statement should be a PHP file. So when the consumption savings of the page. Php .
Advantages of PHP include page
Resulting page is lower. So small required webspace .
As the codes are divided into several segments so that it is easier to maintain.
Finally PHP is free software. So there is no additional cost you need to get PHP.
8webcom are Indian base Web Development Company and we are in to services like PHP Web Development.
Related Articles -
Web Development Company, PHP Web Development,