We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32678
    • 290 Posts
    Howdy -- I have created the ability for site owners (i.e. non-technical front-end users) to customize their site header and footer (e.g. site logo, tagline, etc.) by associating TVs with @INHERIT bindings to a parent resource called ’Global Settings’. This isn’t published, but all other resources of the sites (published or otherwise) are its children. The TVs have placeholders in the site header/footer chunks, allowing these global values to be set in one place and to appear on all Web pages that include those chunks.

    This works great with one exception -- the URL includes the unpublished parent document. So, as an example, if I navigate to the news page, the URL is http://site-URL/global-settings/news. Is there a way to prevent "global settings" from appearing in the URL?

    Thanks for the help!

      • 32678
      • 290 Posts
      Nevermind -- think I figured this out:

      [tt]Options +FollowSymLinks

      RewriteEngine On

      RewriteRule ^news, contact, etc.(/(.*))?$ /global-setting/$2 [QSA,L]

      RewriteRule ^$ /modx/ [QSA,L]

      RewriteCond %{SCRIPT_FILENAME} !-f
      RewriteCond %{SCRIPT_FILENAME} !-d
      RewriteRule !^(news|contact|etc|global-settings)(/.*)?$ /modx%{REQUEST_URI} [QSA,L][/tt]
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Previously, we’d simply put the header/footer stuff in Chunks. All other chunks we don’t want our clients to touch have been protected.

        TVs should be used to have different content for different resources, even though the template remains the same.

        If you’re really sure you don’t want to use a chunk, I’d even prefer making a single document and access its values with a snippet using the API. Seems much cleaner imo.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 32678
          • 290 Posts
          I am using chunks. There’s a header and footer chunk, both of which are customized via TVs with @INHERIT as a default. When the site owner sets their values on the global setting page, those values are inherited by all pages of the site. Originally, I associated the TVs to the homepage but even though the header/footer chunks are used by all pages, the TV values showed up only the homepage.
            • 32678
            • 290 Posts
            Thought I’d post a follow-up to this, as I’ve since adapted the technique that Greg Smart writes about on his blog, using [GetField] to populate global values from a config page: http://www.gregorysmart.com/2010/01/08/create-a-user-config-page-in-modx/. Works very well.