Connecting Tech Pros Worldwide Forums | Help | Site Map

../ not working for images pulled from within an include file

djsjm's Avatar
Newbie
 
Join Date: Nov 2008
Location: USA
Posts: 23
#1: Nov 9 '08
Hi guys!

I may be overlooking something dumb here...

For a series of subdirectories I put the masthead in as an include file, with ../ up to the directory above it. Problem is, it won't pull the images unless I have a masthead file in every single one of numerous subdirectories. Way too much work to update and it seems like uneccessary duplicate files.

Can someone tell me... is there some reason with PHP that this won't work?

~ Debbie

dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#2: Nov 9 '08

re: ../ not working for images pulled from within an include file


don't put the ../ in the image.

If you have file "foo.php" and need to include "bar.php", any images in "bar.php" need to have relative path as if they were in foo.php.

Images are not called server side, they are called by user's browser. Experiment on the URL that you need for the images to work.



Dan
djsjm's Avatar
Newbie
 
Join Date: Nov 2008
Location: USA
Posts: 23
#3: Nov 9 '08

re: ../ not working for images pulled from within an include file


hi Dan! I just popped back online to post that I figured out what I was doing wrong.

I have no idea what a foo is past a foo fighter... and the only bars I know about are the ones that card you at the door and come in the form of chocolate (I partake of neither!).

What did the trick was simply having a masthead for each of the levels of pages, and within each masthead, putting how many ever ../s before each image that it took to get the job done. 3 masthead files instead of about 100. Works for me!

=)

Nice to see somone is around while I'm being insane at 2 in the morning.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,940
#4: Nov 9 '08

re: ../ not working for images pulled from within an include file


Quote:

Originally Posted by djsjm

I have no idea what a foo is past a foo fighter... and the only bars I know about are the ones that card you at the door and come in the form of chocolate (I partake of neither!).

Nice to see somone is around while I'm being insane at 2 in the morning.

Foobar is just programming riffraff, used to explain different things. It/they have no real meaning.

Glad you got it sorted, although I couldn't make sense of the problem, but I have just got up.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,649
#5: Nov 9 '08

re: ../ not working for images pulled from within an include file


Quote:

Originally Posted by Markus

Foobar is just programming riffraff, used to explain different things. It/they have no real meaning.

that's not quite correct, see RFC 3092
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,940
#6: Nov 9 '08

re: ../ not working for images pulled from within an include file


Quote:

Originally Posted by Dormilich

that's not quite correct, see RFC 3092

Wow, someone must've been bored to go through all that effort to give meaning to nothing.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,649
#7: Nov 9 '08

re: ../ not working for images pulled from within an include file


although my all time favourite is RFC 2324 – time for a coffee using HTCPCP/1.0
Reply