[56K WARN] include question

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

[56K WARN] include question

Post by speedy33417 »

I want to include a header and footer file into my pages. However I have my structure set up in different folders that have more folders. (see img below)
What's the best way to make sure that my links work on each level of my library?

Right now I have my inc file in the image folder on the top level. Ho do I link to images to work on every level?
I'd rather not create image folders for every library that I create and upload every image that use in my inc file to each of them.
I'd also like to avoid pulling them from a database. What other solution do I have?

Image
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_SERVER['DOCUMENT_ROOT'] maybe?
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

Post by speedy33417 »

How do I use that? That's a little advanced for me. I post my include file here. Or should I just use direct path?

Code: Select all

<div align="center">
      <table border="0" width="780" cellspacing="0" cellpadding="0">
            <tr>
                 <td><img border="0" src="images/header.inc" width="780" height="80"></td>
            </tr>
      </table>
</div>
So this would work on my main page, but when I use this one level up, it doesn't.
Last edited by speedy33417 on Sun Jul 23, 2006 2:54 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're talking in a web page? Well that's a completely different animal: /images will suffice most often.
User avatar
speedy33417
Forum Contributor
Posts: 128
Joined: Sun Jul 23, 2006 1:14 pm

Post by speedy33417 »

Yeah, but that's the thing it's not working.

I only have one image folder directly in my mainwebsite_html folder.

This will work as long as I stay in that directory, but if I leave that say going in to mysite.com/something/ folder than the links won't work.

Hope this clears up my question a little.

Thanks.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Post Reply