We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    Can snippets run inside template variables?

    Perhaps a snippet that checks whether any content exists for at least one of the 3 template variables within a different TV could work:
    [+product-download-catalogue+]
    [+product-download-install-manual+]
    [+product-download-technical+]

    If yes, the snippet confirms yes to PDF existing - if no, it returns blank.

    Then I can use a ditto call like so:
    [[Ditto? id=`ditto4` &parents=`10` &depth=`10` seeThruUnpub=`1` &filter=`tvpdf exists,yes,7`]]

    Possibly maybe?
      Web design Adelaide
      http://gocreate.com.au
      • 21417
      • 486 Posts
      Thanks so much for your help Ottogal and microcipcip.

      I managed to get it working in 2 different ways.

      Using the TV as per Ottogal’s suggestion:

      Ditto Call:
      [[Ditto? id=`ditto57` &parents=`10` &depth=`10` &seeThruUnpub=`1` &tpl=`downloadsRow` &filter=`tvadd-to-downloads,yes,7`]]


      TV - I created a TV called "add to downloads" with:
      input type as checkbox,
      input option values as Yes==yes and
      default value as no 


      Then click yes for each product that has a download (eg can be done at time of linking a pdf file).

      &tpl=`downloadsRow`:
        <tr>
         <td class="col41">[+pagetitle+]</td>
         <td class="col42">[+description+]</td>
         <td class="col43"> <a href="[+product-image+]" rel="lightbox" title="[+pagetitle+] : [+description+]"><img src="[+product-image+]" id="[+id+]" /></a> </td>
         <td class="col44"> [+phx:if=`[+product-download-catalogue+]`:isnot=``:then=`<a href="[+product-download-catalogue+]" title="Catalogue for [+pagetitle+]" target="blank"><img src="/equity/images/mix/pdf-icon.png" /></a>`+] [+phx:if=`[+product-download-install-manual+]`:isnot=``:then=`<a href="[+product-download-install-manual+]" title="Installation Manual for [+pagetitle+]" target="blank"><img src="/equity/images/mix/pdf-icon-Y.png" /></a>`+] [+phx:if=`[+product-download-technical+]`:isnot=``:then=`<a href="[+product-download-technical+]" title="Technical Data for [+pagetitle+]" target="blank"><img src="/equity/images/mix/pdf-icon-B.png" /></a>`+] </td>
        </tr>



      Using an outer PHx statement in the downloadsRow template:

      Ditto Call:
      [[Ditto? id=`ditto157` &parents=`10` &depth=`10` &seeThruUnpub=`1` &tpl=`downloadsRow4`]]


      &tpl=`downloadsRow4`:
      [+phx:if=`[+product-download-catalogue+]`:isnot=``:or:if=`[+product-download-install-manual+]`:isnot=``:or:if=`[+product-download-technical+]`:isnot=``:then=`
        <tr>
         <td class="col41">[+pagetitle+]</td>
         <td class="col42">[+description+]</td>
         <td class="col43"> <a href="[+product-image+]" rel="lightbox" title="[+pagetitle+] : [+description+]"><img src="[+product-image+]" id="[+id+]" /></a> </td>
         <td class="col44"> 
         [+phx:if=`[+product-download-catalogue+]`:isnot=``:then=`<a href="[+product-download-catalogue+]" title="Catalogue for [+pagetitle+]" target="blank"><img src="/equity/images/mix/pdf-icon.png" /></a>`+] 
         [+phx:if=`[+product-download-install-manual+]`:isnot=``:then=`<a href="[+product-download-install-manual+]" title="Installation Manual for [+pagetitle+]" target="blank"><img src="/equity/images/mix/pdf-icon-Y.png" /></a>`+] 
         [+phx:if=`[+product-download-technical+]`:isnot=``:then=`<a href="[+product-download-technical+]" title="Technical Data for [+pagetitle+]" target="blank"><img src="/equity/images/mix/pdf-icon-B.png" /></a>`+] </td>
        </tr>
      `+] 


      Both work fine - just have to work out how to get Ditto to order by column1 and then by column 2

      Thanks again to everyone that helped on this.

        Web design Adelaide
        http://gocreate.com.au
        • 19369
        • 1,098 Posts
        With the first method, the user has to upload the PDF and then the TV will return a "yes" value? If so, it seems the right solution.
        Btw, if you use the second method make sure that the product description isn’t too long, otherwise you will have troubles with PHx parser limit.