We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27305
    • 173 Posts
    I want ditto to pull out the template variable’s not the main body content.

    What is the syntax to enter a template variable using ditto

    I have

    [!ditto? &startID=`44` [+tvAffiliate_Description+] !]

    Its not doing anything is the syntax correct? my variable is called Affiliate_Description do I need to append tv on it?

    ss
      I made my first site with modx
      ------------------------
      Shopping blog
      Sky+ HD
      • 18397
      • 3,250 Posts
      Ditto will automatically pull any TV in a Ditto tpl so long as it is prefixed by tv.

      For instructions on how to create a Ditto tpl see the Ditto documentation on the main support site,
        • 27305
        • 173 Posts
        Got it, I feel a bit of a muppet quite easy to get it to work, its just that the example is a bit weak for a web designer to get your head around, I didnt know you had to create a chunk, so for others try this (feel free to correct me)

        1. Install the ditto snippet
        2. Create your template variables in manage resources/template variables/
        3. Create a category folder and create some sub pages under it (you should see your template variables when adding pages)
        4. Create a chunk (manage resources/chunk) call it dittotemplate or some other name
        5. template variables must contain a prefix of tv so if you named it Affiliate_description it must be [+tvAffiliate_Description+], for the chunk enter something like this;

        <div class="ditto_summaryPost">
        <h3><a href="[~[+id+]~]">[+title+]</a></h3>
        <div>[+summary+]</div>
        [+tvAffiliate_Description+]

        <p>[+link+]</p>
        <div style="text-align:right;">by <strong>[+author+]</strong> on [+date+]</div>
        </div>

        6. save the chunk and edit your main category page
        7. Under document content click the source button and enter this [!ditto? &tpl=`DittoTemplate` &startID=`44`!]
        8. That line calls the dittotemplate chunk you just created starting. The startID is the main category id number.
        9. It should now show all the pages with a summary or whatever you wanted it to show in the chunk.

          I made my first site with modx
          ------------------------
          Shopping blog
          Sky+ HD
          • 18397
          • 3,250 Posts
          Exactly, nicely said.