We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    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.
      • 28042 ☆ 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.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 3749
        • 24,544 Posts
        A System Setting is definitely the way to go for something that should be available site-wide, even without ClientConfig.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 28042 ☆ 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.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 19872
            • 1,078 Posts
            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.
              • 28042 ☆ 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.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 19872
                • 1,078 Posts
                Thanks for clarifying. I'm reviewing client config on the docs now.