php Includes and basic HTML Nightmare

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mmanders
Forum Newbie
Posts: 23
Joined: Sun Jan 16, 2005 7:13 pm

php Includes and basic HTML Nightmare

Post by mmanders »

Hi,

I have a php script located in /login/ of my web root. This script, accesscontrol.php contains code to verify a user, if they are not logged in they sign in thru a form, if they are logged in, the protected content is displayed. This file is included at the top of ever page that has protected content.

The problem is, despite having my include_path set up at the top of the script so the include is always there, the HTML references to images etc change depending upon where the script is currently executing from. I.e. if ./index.php called accesscontrol.php, the links to images etc are fine, however if /foldername/index.php calls the include, then the include file references are wrong. If that made sense, can any one suggest a solution!>

Thanks
Max
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Use an absolute path:

/home/what/www/images/

Or if you need dynamic "../../" read this thread:

viewtopic.php?t=30094

The thread is about links but it will also work for images....
Post Reply