View unanswered posts | View active topics It is currently Sat Jun 25, 2022 6:26 pm



Reply to topic  [ 4 posts ] 
 Paths from subchild to root folder 
Author Message
Junior Member

Joined: Sat Dec 05, 2009 4:39 pm
Posts: 4
Post Paths from subchild to root folder
Here is my structure:
Root
(Header.php) {Header.php references Images/image.jpg}
Subfolder Images
image.jpg
Subfolder fold_1
SubSubfolder fold_1-1
SubSubSubfolder fold_1-1-a
index.php

What is the syntax to include Header.php in index.php?

In other words I would like to have a common Header on all of my pages.
I have Header.php appearing but no images.
The path for the images has to be changed with ../ which defeats the purpose of using a single Header.

Yes I am brand new to PHP.

Thanks for the help,
Ralph


Sun Dec 13, 2009 5:32 pm
Report this post
Profile
Junior Member

Joined: Sat Dec 05, 2009 4:39 pm
Posts: 4
Post 
Xnuiem wrote:
because php is server side, you need to reference the images from where they are as relative to the file including them.

In this case, since header.php is including them, you need to reference them from there.

So, you include header.php in your other files, and in header.php you include the images by SUBFOLDER/IMAGE


Sorry that is what I was trying to say only the image does not show!

The image is relative to header.php in index.php so it does not show!
[HTML]
<img border="0" src="image/PHP.png" width="153" height="51" />
[/HTML]
This works for a direct image link:
[HTML]
<img border="0" src="../../Images/PHP.png" width="199" height="105" />[/HTML]

The problem is "I have Header.php appearing but no images."

The image does not appear just a empty rectangle with a broken link icon using Fire Fox.


Mon Dec 14, 2009 9:14 pm
Report this post
Profile
Junior Member

Joined: Sat Dec 05, 2009 4:39 pm
Posts: 4
Post 
I have tried using absolute paths, which would be logical but they also fail with no image shown.

What is the syntax for a absolute path? I can not believe I have to ask that but everything I have tried has failed.

Thanks for our replies,
Ralph


Tue Dec 15, 2009 8:01 am
Report this post
Profile
Junior Member

Joined: Sat Dec 05, 2009 4:39 pm
Posts: 4
Post Paths from subchild to root folder Solution
Xnuiem wrote:
It just starts from the root of your website.

so, it should be /Images/image.jpg


Darn I am sure I "tried" that before asking, this is embarassing.

Thanks works as directed!
Ralph


Tue Dec 15, 2009 9:44 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.