We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49667
    • 59 Posts
    I have a parent with multiple children (articles).
    Both parent and children have the same "articles template".

    With each article comes an image (next to author, plublication date, summary, etc.).

    I created a TV for the image called [*tvimage*].

    My template has a Ditto call that shows all articles with their individual author, publication date, summary, etc. The Ditto call is this
    [[Ditto? &parents=`6` &display=`all` &orderBy=`createdon DESC` &tpl=`articlesfull`]]


    The articlesfull chunk says this:
    <div class="base-container">
            <div class="item">
                <div class="col-lg-9">
                    <div class="well">
    		[+pagetitle+] [+author+] [+date+] [+content+]				
                    </div>
                </div>


    Now in this chunk I wanted to put: [*tvimage*] next to pagetitle, author, etc. -> didnt work.
    Then, [+tvimage+] -> didnt work.

    Then I created a a tvimage chunk with
    <img src="[*tvimage*]">
    . Because apparently just the tvimage TV only shows a link to the image (???).
    Then I put my new tvimage chunk {{tvimage}} in my articlesfull chunk and put it next to pagetitle, author, etc. like this [+pagetitle+] [+author+] [+date+] [+content+] {{tvimage}} -> Also didnt work!

    Now I am just stumped and crying out for help... smiley
    (the last option came very close though, but only showed one and the same image all over from my first ID with the "articles template", so I have to find a way that it loads the UNIQUE image for each individual article...) ...

    This question has been answered by iusemodx. See the first response.

    • discuss.answer
      • 13226
      • 953 Posts
      Is your image TV set to "input type: Image" ?

      By rights the content of the TV would be the path to the image, so that being said, your Ditto tpl should have something like:
      [+pagetitle+] [+author+] [+date+] [+content+] <img src="[+tvimage+]" alt="">

      Note: in the Ditto Tpl you have to use the Ditto markup "[+blahblah+]" not "[*blahblah*]"
        • 49667
        • 59 Posts
        Hi iusemodx,

        Yes, input type is image.

        Your solution worked! Thanks a lot.

        So what you are saying is that I cannot create a chunk out of a TV image and plunk that chunk into another chunk to refer to the image path?? Does that only go for TV image input type or other TV input types too?

        I am still learning about Modx, but this surprises me a bit. Thank you for explaining and your solution again.

        Cheers!
          • 13226
          • 953 Posts
          What I am saying is - chunks can incorporate what you want, where you put them is your decision and how you nest them is also your decision - whether or not they work is a different matter.

          Learning by doing or in this and many other situations Learning by testing smiley

          Example 1:
          [*MYTV*] => Image
          {{MYCHUNK}} => contains [*MYTV*]

          To my knowledge this won't work in a Ditto TPL because it uses the standard TV tag {**} and not Ditto tags [++]

          Example 2:
          [+MYTV+] => Image
          {{MYCHUNK}} => contains [+MYTV+]

          This should work in the Ditto TPL because the chunk contains the TV in the proper Ditto format [++]

          So your Ditto TPL could look like:
          [+pagetitle+] [+author+] [+date+] [+content+] {{MYCHUNK}}

          So a real life solution:

          Ditto TPL:
          [+pagetitle+] [+author+] [+date+] [+content+] {{tvimage}}

          Where {{tvimage}} contains:
          <img src="[+tvimage+]" alt="">


          What you have to understand here is, you are pulling information into a bespoke "Ditto" template, Ditto uses its own markup.

          If you were to use example 1 outside of Ditto it would work, again, depending where you use it. [ed. note: iusemodx last edited this post 11 years, 8 months ago.]
            • 49667
            • 59 Posts
            Got it smiley! Thanks again.
              • 13226
              • 953 Posts
              No problem, glad I could help smiley