When entering the path to a static resource file, is there any way to use a system setting?
For example, working with the Doodles extra tutorial, I want to make the Doodles snippet static. I've set a doodles.core_path system setting. How could I use that setting in the static file path? Something like
{doodles.core_path}elements/snippets/snippet.doodles.php
or
[[++doodles.core_path]]elements/snippets/snippet.doodles.php
(neither of which seem to work)
Static File - This field is the path to the file, relative to the media source you selected (or None for absolute paths). You can use tags in this field, such as System Settings, as well.
-
- 483 Posts
Just a suggestion: Did you try the obvious and
make sure the core_path is adding a slash? I've run into little things like this all over ModX.
(i.e.
[[++doodles.core_path]]/elements/snippets/snippet.doodles.php
According to what's stored in the core/cache/system_settings/config.cache.php cache file, it's
'doodles.core_path' => '/Users/sottwell/Desktop/working/htdocs/doodles/core/components/doodles/',
And it's working fine as used in the Doodles class constructor.
Well, that's interesting. I added the extra / as you suggested, and whaddyaknow, it works now. Where does it lose the trailing slash
-
- 483 Posts
In my experience, $modx->makeUrl() and System Settings using paths works mostly. I ran into several problems with this. Sometimes (given particular circumstances that I haven't nailed down), it loses a slash, and sometimes it creates a full URL. Mostly, it works, but I've found that you have to check the little stuff, now and then.
I filed a bug report on at least this instance of this happening.