[S0LVED] get image from parent folder?

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
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

[S0LVED] get image from parent folder?

Post by mikeeeeeeey »

Hi guys,

Is there any way to reference an image(or file i.e. stylesheet, js etc.) from a parent/grandparent directory?

Thank youuuuuuu.
Last edited by mikeeeeeeey on Mon Jul 30, 2007 11:00 am, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

../ for the parent directory.
../../ for the grandparent.
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

Post by mikeeeeeeey »

That made my eyes water with relief onion2k, thank you.
(excuse the horrid pun!)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

You might find it easier to add a <base> tag to you site. For example..

<base href="http://www.ooer.com/" />

..would make all of your URLs relative to "http://www.ooer.com/". An image tag of <img src="images/onion.gif"> would be fetched from "http://www.ooer.com/images/onion.gif". It's a much nicer solution than messing around with parents and grandparents and stuff.
Post Reply