We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5532
    • 251 Posts
    Hi There,

    I might be searching for the wrong thing as I couldn’t find any info so sorry if it’s basic. We have two Template Variables that are only on the homepage - a Date and a Venue. However, we’d also like to include the data from these Template Variables into our header.

    We’ve entered the data into the home page and have created a Header Chunk with the Template Variable names in the correct places. However the date and venue do not show up in the header (they do in the Home page).

    What’s the best way to have content from a Template Variable appear in a Chunk - and therefore site-wide?

    Here is our chunk code:
    <ol>
    <li class="none">
    <h3>[*ShowDate*]</h3>
    </li>
    <li><a href="#">[*ShowVenue*]</a></li>
    </ol>
    

    Any help would be much appreciated.

    Cheers
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Template Variables are only available to the pages using the template they are assigned to when created. If you want them to be displayed on all pages, then you have to check all the template checkboxes.

      You can control visibility and access to a TV while editing pages with document groups just as you can pages, or use the ManagerManager plugin.
        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
        • 5532
        • 251 Posts
        Thanks Scot,

        If we place the Template Variable on every template, wont that mean the client has to enter the Show Date & Venue info on every single page - or have we misunderstood something?

        We’re hoping to find a way so the client enters the info once, and it updates the header site-wide.

        Cheers

          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The default value for the TV (when you create the TV) would be where you would want to edit this. Of course, this TV field would then be visible on all pages, with the risk of accidentally changing it on one page or another, but as I mentioned, it can be hidden on the individual pages either via document groups or with the ManagerManager plugin.

          You could also make the default value of the TV @CHUNK <chunkname> or @DOCUMENT <document ID>, and then just edit the chunk or document referred to in the @... value.
            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
            • 5532
            • 251 Posts
            Thanks for the reply.

            I think I understand - create a TV with a default value then hide it in the editor. Then the client can edit the template variable once a year.

            Cheers