This is a simple question, but I am having problems coming up with a sensible answer to it.
I have a dynamically generated site, where all the pages are generated from a single script e.g.
index.php?page=main/aboutMe
Individual pages are made up of elements, for instance, the body:
main/aboutMe.html
The navigation bar:
navigation/default.html
The main template
templates/main/default.html
Each of these elements might have images associated with it. All images reside in a directory called 'images' in the directory in which they reside. So for example, images for the aboutMe.html element would be held here:
e.g. main/images/picture.jpg
this means that the link within the page is thus
<A HREF="images/picture.jpg">
The problem is that the of course in the final page generated by the index.php file, all of the image links point to images/x.jpg, when in reality the images actually reside in
different directories in the directory tree.
Of course I could get the index.php to to an ereg_replace on each of the element files as it reads them in, replacing the HREF="images/ with the path to that element, but it seems a sloppy way to do it. I want to do it as elegantly as possible.
Any ideas for an elegant solution to this simple problem?