I have a URL to another site that I need to use repeatedly throughout a site. I can hard code it into a chunk for buttons I am creating, but if the user wants to also create a text link, is there a preferred way to handle that other than typing the absolute URL into the link manager each time.
The reason I ask is because if the link ever changes, I'd like to be able to simply change it in one place. At the moment, I have it in a template variable, but updating the URL would require updating every resource that the variable is in.
A chunk would work, but is it advisable to let end users have access to the chunks?
Should I create a context for it?
Should I create a blank resource with a php redirect on the template?
Any suggestions greatly appreciated.
-
☆ A M B ☆
- 24,524 Posts
You might want to look into ClientConfig, which is a way to allow clients to have minimal access to emulated System Settings. A custom setting like [[++other_site_url]] can be accessed for changing its value through the ClientConfig interface.
A System Setting is definitely the way to go for something that should be available site-wide, even without ClientConfig.
-
☆ A M B ☆
- 24,524 Posts
Can't let the client change it if necessary without allowing him access to the whole System Settings. That's where ClientConfig comes in.
Thanks for the feedback Susan & Bob. Much appreciated. This is my first project that instead of managing myself, I'll be letting go of the reigns, so I am a bit anxious. ClientConfig sounds familiar—will review my notes. If I add a new system setting though—don't I need to be aware of that when doing future MODx updates.
-
☆ A M B ☆
- 24,524 Posts
No, upgrades don't overwrite the database. Besides, ClientConfig uses its own tables.
The [[++...]] tags of System Settings are actually nothing more than ordinary placeholders with a prefix of +. ClientConfig's plugin does the same thing with its custom values - and since these are loaded after the regular System Settings values, the ClientConfig values will override any conflicting System Settings values.
Thanks for clarifying. I'm reviewing client config on the docs now.