modxmodx-revolution

Is there any way in modx that will automate the writing of relative paths?


I have a lot of pages and I need to write paths to js and css styles on all of them. The "js" and "css" folders are stored in the Filesystem. The problem is that the higher the nesting level of the page, the more I need to put "../" in front of the style. For example, one of the paths on my most recent page by nesting level should look like this: "../../../../../ css/myfile" Is there any command that I could put instead of dots and slashes so that modx itself determines the relative path?


Solution

  • have you tried to use <base href="[[++site_url]]"> in header? that should eliminate the need for going ../../../ as it will be relative to base path and url