What I did on my site is made a file called config.php, I then made a
variable for all the files that need to be included, example, header,
footer, leftnav, rightnav, etc..

My config file looks like this:

<?php
 $header      ="/home/public_html/includes/header.php";
 $rightnav    ="/home/public_html/includes/rightnav.php";
 $leftnav     ="/home/public_html/includes/leftnav.php";
 $footer      ="/home/public_html/includes/footer.php";
 // and many other include variables here..
?>

Then I simply call config.php into all my pages and when I want to include a
file I just do:

<?php
include("$header");

// html and stuff....

include("$footer");
?>

my config.php has all my site includes and it allows me to dynamically
change anything throughout the site in a matter of seconds.
hope this helps.

Sebastian - [BBR] Gaming Clan
http://www.BroadBandReports.com

----- Original Message -----
From: "CF High" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 22, 2003 3:14 PM
Subject: [PHP] Sitewide Header & Footer Includes || Trouble with Relative
Paths..........


> Hey All.
>
> Got a perhaps easy question here:
>
> How can I create a global header and footer include to my site pages where
I
> don't rely on absolute paths to include and image files?
>
> I'm having trouble including my header and footer .inc's within a
> multi-level directory structure -- the relative paths to images (and to
> includes within includes) are not currently accessed within the current
> directory structure.
>
> I'm assuming I'll need to prepend all image and include files with a path
> variable that I set within each page, or something along those lines?
>
> Any help much appreciated,
>
> --Confused



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to