About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > Include...

   Browse by title articles:
   What is hot:

Character Classes

Matching/Replacing

Functions - Intro

Functions - Arguments

Functions - Return Values

Include

Backup - How to Avoid a Disaster
Web Designing Tips
PHP for Dummies
Linux - Step by Step Install of Apache PHP SSL and more
Prev articles123456789 10 1112Next articles



Include


Computer & I'net articlesInclude

by David Stanley    



The include command is very similar to using an SSI include. It calls a block of information from a different page into the current webpage.

include ("filename.php");

Include will pass the information from an external page into the current one. The information that is passed will be known and usable to the coding that appears after the include command. Coding that appears before the include command will not "know" about the information contained in the included file.

info.php
<?php
$color = "yellow";
$fruit = "bananas.";
?>

test.php
<?php
echo "I like $color $fruit <br>";
include ("info.php");
echo "I like $color $fruit <br>";
?>

Results :
I like
I like yellow bananas.

One of the many uses of includes is to set common webpage areas into seperate files and include them into each page like a template style layout. This site uses php includes. One for the main header area, one for the navigations, and one for the footer area.

Another benefit to using includes would be to include a specific file IF a condition is true ELSE a different one upon a false condition.




-----------------
Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.





Lease




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com