I’ve managed to get my parent child URLs sorted so that now they are like this:
www.example.com/parent-page/child-page
Everything is sweet and also got the breadcrumb stuff working, problem I have is that my image won’t serve despite it pointing to exacttly the same directory as before?
If I leave my page like this:
www.example.com/child-page
without giving it the parent, everything is fine with the image, if I add it to the parent then it won’t serve, despite the rendered page code pointing to exactly the same directory:
<img src="assets/images/example.jpg"
This is truly baffling, the CMS lets me upload the image through the backend etc but???
Anyone shed any light on this? Thanks for any advice in advance.
Add this inside your <head></head> tags: <base href="[(site_url)]"></base>
I believe it’s an issue with my file path as I have gone another level deeper! Your method works so thanks very much, I wouldn’t have thought of this one! Have you any idea why the new file directory is not picked up when I insert the image through the CMS? Thanks again
Your Document/Resource marked as Container is not the same as folder levels in the file system...
If you don’t use <base href> tag in your template you will need to add [(base_url)] tag in the paths.
Absolute path
<img src="[(base_url)]assets/images/example.jpg"
Relative path (it’s now controlled by the <base href> tag)
<img src="assets/images/example.jpg"
[(base_url)] is the same as adding a slash if MODx is installed in root folder. (src="/assets...) Most snippets etc. uses absolute paths.
The URL for a Document/Resource Container
that is saved in the database is rewritten by
htaccess when FURL (Friendly URL) is enabled. It looks like being a folder but it’s just an illusion and disguise!
http://wiki.modxcms.com/index.php/Beginner%27s_Guide_to_MODx
http://wiki.modxcms.com/index.php/Friendly_URLs_Guide
http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
Thanks a lot for the informtation. Everything is working fine now and I am just working out how to get round the next problem! Don’t suppose you know how I can set me SEO Override plug in so that the default on hte drop down is ’basename’ This seems to be the setting I need but I have to select it each time I produce a page, small problem I suppose but pretty sure somone out there knows how to rectify this?! In fact, it seems like whatever I select from the drop down makes no difference, my URLs are friendly and seem to be fine..