We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24161
    • 16 Posts
    Okay...I’m liking MODx, but understanding what does what and what works together is a bit of a chore. It’s hard to find out how to do something, until you know what it is that will do what you want. Then you’ve gotta’ find out how to do it with that specific addition.

    Which leads me to Ditto laugh

    Got a site. It’ll have specific content that’s only present on specific documents. So...

    * On each document/page, the masthead image would change
    * On one document/page, I might have a piece of content that doesn’t appear on any other page (like a ’brand’ gallery or similar
    * On each document/page, I’ll have a different ’header’ for whatever document is being displayed

    So on and so forth.

    Is this something I’d use Ditto for? And more importantly, HOW would I do such? How could I make something (a chunk, a snippet, or a TV) that is specific to a certain document, and then implement it.

    Sorry if this sound ridiculously ’noobish’, but, that’s probably because it is laugh
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      No, this is not what Ditto is for. This is what TV (Template Variables) are for. Create a TV for each variable item, attach them to the template the documents will be using. Then when you edit a document using that template, under the Document content field you’ll see fields for editing the content of your TVs.

      Put the TV tags [*myTV*] wherever you want the output to appear, either in the template or in the document’s content.

      When you create the TV, the default value of the TV can be any number of things, from simple text, images, PHP code (@EVAL), or other @BINDINGs. See the Documentation for that. I mostly use the @INHERIT binding. This way I edit the TV for a container/folder document, and all of its children will inherit that value. Great for setting up headings and images and menus for entire sections.

      Using a TV with an Input type of Image and an output Widget of Image give an image insert input field when editing the document, and a set of image tags with the proper src link as output.
        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
        • 24161
        • 16 Posts
        ok, so...here’s where I’m a little confused: Would I make a new Template for each page? Seems like that’s a little redundant.

        So that if my page was the same, except that the navigation element was highlighted and the masthead was different, I’d need to create an entire new template rather than just find a way to add those elements on certain conditions?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No. When you create a TV make sure the checkbox for your template is checked at the bottom. Now every page that uses that template will have an extra field to edit the TV’s value for that page.
            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