View Single Post
  #2 (permalink)  
Old 12-21-2005, 09:32 AM
nsvr nsvr is offline
Member
 
Join Date: May 2005
Posts: 169
iTrader: (0)
Rep Power: 20
nsvr is on a distinguished road
Send a message via MSN to nsvr
Default

Hmm, not completly correct, you can use include witouth the (), but the correct way is like:

Code:
<?php include("includes/header.php"); ?>
And i dont recommend to use the full path for includes, just do it like above. If you want to use the full path, use the variable $_SERVER["DOCUMENT_ROOT"], where the /home/username/public_html is already stored in like:

Code:
<?php include($_SERVER["DOCUMENT_ROOT"] . "/includes/header.php"); ?>

And remember if you do that, use superglobals, in this case the super global $_SERVER, although $DOCUMENT_ROOT will also work, but thats for older versions of php.

Another nice thing about php is that you can configure the auto_append_file and auto_prepend_file, with a htaccess file.
This way, php will automatically add at the beginning/end of the php file the header and footer configured by these.
Reply With Quote