We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32654
    • 26 Posts
    I have a listing page with links to international articles on my site via a Ditto call

    [[Ditto? &parents=`109` &display=`20 &sortBy=`myDate` &dateSource=`myDate` &dateFormat=`%d-%b-%y` &tpl=`LatestNews2`]]

    However I want to be able to automatically link a country flag image to each listing depending on which country it is.

    The flags are in assets/images/flags

    I think the next thing to do is make a new TV say for example [*newsFlags*] and add it to the LatestNews2 chunk. but what parameters do I make the TV so each listing has the appropriate flag next to it?

    Any help much appeciated.

    w
      • 4310
      • 2,310 Posts
      A quick way might be to:
      1. Use the [*description*] TV for each article and enter the country.
      2. Add a .jpg named the same as the description TV for each country.
      3. In your Ditto LatestNews2 chunk add the reference to the image so :
      <img src="assets/images/flags/[*description*].jpg" alt="[*description*]" />
        • 32654
        • 26 Posts
        hi b58,
        thanks for that.
        I have now used the [*description*] tv and added it to the chunk as well as adding the flag gif name in the description field but for some reason it is not picking up the image. Not sure where I have gone wrong.

        LatestNews2 chunk

        <td width="552"> <p><img src="assets/images/flags/[*description*].gif" alt="[*description*]" /></p><p class="latestnews_date">[+date+]</p>
        <p><a href="[~[+id+]~]" class="latestnews_description">[+pagetitle+]</a></p></td>


        If I take out the [*description*] part of the path and replace it with the name of a flag the image appears so why is the description tv not showing the flag?
        Should I have given the description tv a value of some sort?

        w
          • 4310
          • 2,310 Posts
          Sorry I was a bit too quick!
          Change [*description*] to [+description+] as Ditto has already put the TV content into a placeholder.
          This time I checked it worked first. wink
            • 32654
            • 26 Posts
            Yep,
            That works. Many thanks
            w smiley
              • 4310
              • 2,310 Posts
              Hurray, got there in the end. grin