We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33993
    • 9 Posts
    Hey guys!

    I looked through the forums but no solution seemed to work for me, sorry!

    I have a TV for a preview image for blogposts and want to hide it if the user doesn't specify it when creating a new blogpost.

    This is my chunk:
    <div class="ditto_summaryPost">
      <img src="[[++site_url]]assets/images/[[+tv.PreviewImage]]" width="50px" height="50px" alt="[[+pagetitle]]" style="float: left; padding-right: 5px;" />
      <h3><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></h3>
       
      [[+introtext:empty=`[[+content]]`]]
      <p class="ditto_link"><a href="[[~[[+id]]]]" class="readmore">Weiterlesen</a></p>
       
    </div>


    TV is "PreviewImage" and this
    [[+tv.PreviewImage:isempty=``:else"<img src="[[++site_url]]assets/images/[[+tv.PreviewImage]]" width="50px" height="50px" alt="[[+pagetitle]]" style="float: left; padding-right: 5px;" />`]]

    doesn't work for me...

    Any suggestions?

    Thank you in advance!

    - Chris

    This question has been answered by Henrik Nielsen. See the first response.

      • 12028
      • 152 Posts
      Instead of using empty you should try: isnot

      Like this:
      [[+tv.PreviewImage:isnot=``:else"<img src="[[++site_url]]assets/images/[[+tv.PreviewImage]]" width="50px" height="50px" alt="[[+pagetitle]]" style="float: left; padding-right: 5px;" />`]]

        - A small step for mankind, so why not take two...

        Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
        • 33993
        • 9 Posts
        Thanks! But this works only partially - now when I define a "PreviewImage", it only shows the filename of the image but not the image itself. Strange?!
        • discuss.answer
          • 12028
          • 152 Posts
          Sorry - I made some mistyping...

          Try this:
          [[+tv.PreviewImage:isnot=``:then=`<img src="[[++site_url]]assets/images/[[+tv.PreviewImage]]" width="50px" height="50px" alt="[[+pagetitle]]" style="float: left; padding-right: 5px;" />`]]
            - A small step for mankind, so why not take two...

            Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
            • 33993
            • 9 Posts
            Quote from: Henrik at Oct 02, 2011, 09:55 AM
            Sorry - I made some mistyping...

            Try this:
            [[+tv.PreviewImage:isnot=``:then=`<img src="[[++site_url]]assets/images/[[+tv.PreviewImage]]" width="50px" height="50px" alt="[[+pagetitle]]" style="float: left; padding-right: 5px;" />`]]

            That did it! Thank you very much Henrik!