Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Stephen Kay
March 30, 2006, 7:21 am
rate this thread
have relative links to images inside the same folder, into another document
(a template) in a different folder level, the links will be broken.
Is there some magic trick to dealing with this, or is it just better to
never use relative links in a site that will be dynamically driven with php?
Re: relative vs. absolute links in php driven pages?
Well, several opinions on this subject.
my 2 cents:
Your problem manifests in many forms, also with includes.
I made it a habbit to make a config-file for each PHP-project, and make a
simple function (or constant) in there that points to eg:
- absolute path (URI) to imagedirectory
return "http://www.blabla.com/images /";
You can do the same for includes, but it is easier to overwrite a php.ini
setting for each script named include_path.
use ini_set() for that.
If you include both above every script, you have easy acces to all your
More solutions exists, but I like this one because it is easy and clean.