Wednesday, December 26, 2012
INCLUDE IN PHP
You can insert the content of one PHP file into another PHP file before the server executes it, with the include() or require() function.
Assume that we have a set of urls (as circled below) or a menu to be displayed in all pages of your application.
The below code of particular set of urls should be included in all your files. When the application consists of many pages it will difficult for you to edit or insert the code. So to simplify we use the include function of PHP. We save the below code in a file called sms2.php
The include function can be used as shown below.
Even if we have included the code in a separate file, when we view the page source of the main file we get the output as shown below.