user4fun Posted February 28, 2009 Share Posted February 28, 2009 root directory has1- index.php2 -inc/main_bar.inc3- images/happyimage.pnginc/main_bar.inc shows the happyimage.png by "../images/happyimage.png"index.php has include("inc/main_bar.png");The images do not show up. How do i fix that? Link to comment Share on other sites More sharing options...
AElliott Posted February 28, 2009 Share Posted February 28, 2009 If you're including from inc/ then (it's not this simple, but for the purposes here) it's basically as if the include construct takes the contents of main_bar.inc, and outputs them in place of the include statement. So the paths should be relative to index.php, if that's not the case that may be the issue.You can also define exactly what the paths are relative to by using a <base> tag in the <head> of the document. You could also make the paths absolute by relating them to the root of the domain (e.g. for mysite.com the path "/images/img.png" always refers to mysite.com/images/img.png wherever that path is). Link to comment Share on other sites More sharing options...
user4fun Posted February 28, 2009 Author Share Posted February 28, 2009 You dont see a problem with using abosolute link in all include files? Link to comment Share on other sites More sharing options...
Ingolme Posted March 1, 2009 Share Posted March 1, 2009 Once the file is included, the directory you're in is relative to the file that included it.Therefore, using "images/happyimage.png" as the image URL should work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.