I am looking for a solution to what i'd imagine to be a common situation, but for which i am drawing a blank:
Suppose /dir/index.phtml does an
include("sub/body.html") and sub/body.html has the tag <IMG SRC="pic.jpg"> and the file pic.jpg is located in /dir/sub along with body.html .
The problem is that the relative URL in the IMG tag prevents loading the image from the included file; the browser sees its URL as "/dir/pic.jpg" which is not a working link.
My goal is to have a bunch of various article bodies (with accompanying pictures), each located in its own subdirectory under a main directory where the index.phtml can include any one of them. If possible, i would like each article to be "self-contained" within its own subdirectory, i.e. avoid requiring them to be aware of their absolute locations. So i'm looking for the simplest way to implement this.... include() seems not to be the answer since relative URLs get broken. Is there another PHP feature or trick to accomplish what i'm looking for? Thanks...