Copy link to clipboard
Copied
Hi,
I have a page navigation menu that I placed in a template file. All the browsing files would then call this template file using cfinclude.
I now want to call this file from a different directory. However, this causes all the url and image links to be wrong because the template file uses relative path off of root directory.
I have looked at using cfmodule, but it seems that I would have the same issues unless I make the paths absolute, which I am trying to avoid.
I also thought of prepending to every link in the template file with a directory prefix variable which I passes from the calling files.
Is there an easy and better way to solve this?
Thanks!
Min
Simple. Use root-relative links, not relative links, in the included file.
Copy link to clipboard
Copied
To dynamically get the absolute path from a relative path take a look at expandPath()
http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_e-g_05.html
Copy link to clipboard
Copied
Simple. Use root-relative links, not relative links, in the included file.
Copy link to clipboard
Copied
Hi David,
I didn't know what a root relative links was, so I looked the term up. That is exactly what I need. Thank you very much!
Min