Re: Sitewide Header & Footer Includes || Trouble with Relative Paths..........
| From: | CF High | Date: | Sat, 22 Feb 2003 23:19:18 +0000 |
| Subject: | Re: Sitewide Header & Footer Includes || Trouble with Relative Paths.......... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136661@lists.php.net to get a copy of this message | ||
Hmmmmmm........
Sounds like a good idea, but we've got quite a few includes in our site, not
to mention variable image paths (i.e. images/headers, images/groups, etc.)
Seems like a lot of work to create & maintain this config file + load the
references on each page.
Maybe I'm just lazy, but I wonder if there is isn't a more direct way to
modularize a site?
I'll check out your idea in any case as I haven't come up with a better
solution myself.
Thanks for the feedback,
--Noah
"Sebastian" <sebastian@dslr.net> wrote in message
news:003b01c2daa4$57ebad30$b0a13f44@level3...
> 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" <noah@newminddesign.com>
> To: <php-general@lists.php.net>
> 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
>
>