简体   繁体   English

modx 中有什么方法可以自动写入相对路径吗?

[英]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.我有很多页面,我需要在所有页面上编写 js 和 css styles 的路径。 The "js" and "css" folders are stored in the Filesystem. “js”和“css”文件夹存储在文件系统中。 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?例如,按嵌套级别,我最近页面上的路径之一应如下所示:“../../../../../ css/myfile” 是否有任何命令可以代替点和斜杠,以便 modx 本身确定相对路径?

have you tried to use <base href="[[++site_url]]"> in header?您是否尝试过在 header 中使用<base href="[[++site_url]]"> that should eliminate the need for going../../../ as it will be relative to base path and url这应该消除对 going../../../ 的需要,因为它将相对于基本路径和 url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM