We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21417
    • 486 Posts
    Hi Jako,

    You are a superstar.

    Thanks so much for providing and outlining the PHx modifier. That works brilliantly.

    I am using it in the RHS of a template to show and hide buttons depending on whether the multiTV content exists.

    Given this is used directly in a template and that the page id changes depending on what page you are viewing, I am using it like so:
    [*phx:multitvisempty=`tvname`:then=``:else=`{{chunk}}`*]

    Is it ok to exclude the " |docid " in the call? Or better to use " |[*id*] "?

    It seems to be working as is but thought I would ask your advice.

    Thanks again Jako, this is a great addition.
      Web design Adelaide
      http://gocreate.com.au
      • 21417
      • 486 Posts
      Hi Jako,

      I still can't work out how to best do the anchor sub menu.

      My ditto call is:
         <div id="anchors">
          <h2>Jump to...</h2>
           <ul>
      [!Ditto? id=`content[*id*]` &startID=`128` &depth=`0` &showInMenuOnly=`1` &tpl=`techdata-row` &orderBy=`pagetitle ASC` !]
           </ul>
         </div>


      My ditto &tpl=`techdata-row` is:
      [+phx:input=`[[multiTV? &tvName=`files` &docid=`[+id+]` &rowTpl=`multiTV-pdf-rowRHS` &outerTpl=`multiTV-pdf-wrapperRHS`]]`:outer=`
      <li><a href="#anchor[+id+]" title="[+pagetitle+]">[+pagetitle+]</a></li>`+]


      &outerTpl=`multiTV-pdf-wrapperRHS` is:
      [+wrapper+]


      &rowTpl=`multiTV-pdf-rowRHS`
      <span>nbsp;</span>


      This returns the submenu correctly but includes 1 x nbsp; for every pdf file that each page has.

      I can hide the nbsp; with css but its not the nicest way to do it.

      What is the best way to do this?

      I also tried:
      [!Ditto? id=`content[*id*]` &startID=`128` &depth=`0` &showInMenuOnly=`1` &tpl=`techdata-row` &orderBy=`pagetitle ASC` !]


      with &tpl=`techdata-row` as per below but that returns 51 x EMPTY (one for each product page):
      [+phx:multitvisempty=`files`:then=`EMPTY`:else=`<li><a href="#anchor[+id+]" title="[+pagetitle+]">[+pagetitle+]</a></li>`+]


      Any ideas?
        Web design Adelaide
        http://gocreate.com.au
        • 21417
        • 486 Posts
        Hi again Jako,

        Another thing I am struggling with when using multiTV images with ditto is including ditto results even if the "images" TV is empty.

        I don't mind if some of the pages don't have images, I don't want that to be the deciding factor on whether or not they are included - I still want the ditto results returned even if some pages don't have images.

        Normally I would do that with this in the ditto row tpl:
        [+images:isnot=``:then=`{{button-Tech}}`+]


        So I tried the following in a few different spots but that did not seem to work:
        [+phx:multitvisempty=`images`:then=``:else=``+]


        In the current instance with multiTV I am trying like this:
        [!Ditto? id=`projectfeed` &startID=`181` &depth=`0` &display=`10` &randomize=`1` &tpl=`projects-menuH-row2` &noResults=`preview-menu-NO`!]


        &tpl=`projects-menuH-row2` =
        [+phx:input=`[[multiTV? &tvName=`images` &docid=`[+id+]` &outerTpl=`multiTV-images-wrapperH` &rowTpl=`multiTV-images-rowH` &rows=`all`]]`:outer=`<h3><a href="[~[+id+]~]" title="[+pagetitle+]">[+title+]</a></h3>
          <div class="blurb"><p><a href="[~[+id+]~]" title="[+pagetitle+]">[+content:word_limit=`60`:striptags+]...</a>
          <span class="more"><a href="[~[+id+]~]" title="More info">More »</a></span></p></div>`+]


        &outerTpl=`multiTV-images-wrapperH` =
        <div class="thumbBox">
        [+wrapper+]
        </div>


        &rowTpl=`multiTV-images-rowH` =
        <a href="[+image+]" title="[+title+]" class="ga11ery th" rel="photos"><img src="[+image:phpthumb=`w=80&h=60&zc=1&q=80`+]" class="thumbImg" alt="photo" /></a>


        Even though I have specified Display = 1 in the ditto call, sometimes I get NO resullts, sometimes I get 1 result - this is wierd behaviour between ditto and MultiTV and not what I am expecting.

        Any ideas on how I can finetune this to return results even if the images TV is empty?

        Thanks in advance.
        [ed. note: nickf08 last edited this post 14 years, 4 months ago.]
          Web design Adelaide
          http://gocreate.com.au
          • 21417
          • 486 Posts
          Me again.

          I am also wanting to use multiTV with a ditto image menu with a ditto template like so:

          <li><a href="[~[+id+]~]" title="[+pagetitle+]" class="th">
          <img src="[+multiTV+](eg the Image)" alt="menu image" class="pic" />
          <span><b>[+phx:if=`[+menu-txt+]`:is=``:then=`[+pagetitle+]`:else=`[+menu-txt+]`+]</b></span>
          </a></li>


          My ditto call is:
          <ul>
          [!Ditto? id=`imagemenu2` &startID=`[*id*]` &depth=`1` &tpl=`image-boxing-menu-row` &orderBy=`menuindex ASC` &filter=`id,[*id*],2`!]
           </ul>


          &tpl=`image-boxing-menu-row` =
          [+phx:input=`[[multiTV? &tvName=`images` &docid=`[+id+]` &outerTpl=`multiTV-images-wrapper33` &rowTpl=`multiTV-images-row33` &rows=`1`]]`:outer=`<li[[insertClass? &n=`[+ditto_iteration+]` &x=`3`]]><a href="[~[+id+]~]" title="[+pagetitle+]" class="th">|
          <span><b>[+phx:if=`[+image-menu-txt+]`:is=``:then=`[+pagetitle+]`:else=`[+image-menu-txt+]`+]</b></span></a></li>
          `+]


          &outerTpl=`multiTV-images-wrapper33` =
          [+wrapper+]


          &rowTpl=`multiTV-images-row33` =
          <img src="[+image:phpthumb=`w=200&h=140&zc=1&q=80`+]" alt="menu image" class="mainpic" /></a>


          All that is displayed on screen is the pic (it does link to the correct page), not the pagetitle text.

          Even though in the source the code looks fine per row:
          <li><a href="xxx" title="xxx" class="th"><img src="xxx" alt="menu image" class="mainpic" /></a>
          <span><b>xxx</b></span></a></li>


          It's like anything beyond the " | " in the phx: outer=`` bit is not honoured somehow - eg this bit.
          <span><b>xxx</b></span></a></li>


          And again as with the previous post, only pages that have multiTV images are displayed. I want any items that are within this particular parent displayed regardless of whether they have a multiTV image - and where it does exist, to use that image in the menu

          Any ideas?

          Sorry for all the questions, I am finding this tricky to use in all the multiple variations that I'd like to.
            Web design Adelaide
            http://gocreate.com.au
            • 13428 ☆ A M B ☆
            • 1,031 Posts
            Ditto rowTpl:
            [+phx:multitvisempty=`images|[+id+]`:then=``:else=``+]


            And if you want to output an image in a div with multiTV if there is one (otherwise nothing):
            multiTV rowTpl:
            [+wrapper:outer=`<div>|</div>`+]


            Hope that helps a bit. [ed. note: Jako last edited this post 14 years, 4 months ago.]
              • 21417
              • 486 Posts
              Thanks for all your help Jako, I really appreciate it.

              This is a phenomenal snippet - I can't believe how easy it is to add multiple pdfs to one document - no more creating a resource per pdf for me! Thanks so much, this is awesome.

              The "paste table" option that you added is sensational - that worked great for me with big lists of pdfs - so quick.

              I found this too tricky and quirky to use with images given my limited technical abilities and the numerous different scenarios required for the project I have been working on. I used MultiImageTV instead for the image requirements - that's much easier to incorporate with Ditto and it creates the thumbnails automatically without needing extra snippets.

              But this is fantastic for pdfs.

              Thanks again.
                Web design Adelaide
                http://gocreate.com.au
                • 21417
                • 486 Posts
                Given the limited documentation of detailed examples for this awesome Evo snippet, I thought I would summarise the code that Jako helped me with and which worked in my situation.

                This presumes PHx is installed in your Evo install.


                1 Using Ditto and MultiTV together to insert multiple pdfs from multiple resources on the one page:

                ditto call:
                [!Ditto? id=`content[*id*]` &startID=`0` &depth=`0` &showInMenuOnly=`1` &tpl=`tech-menu-row` &orderBy=`pagetitle ASC`!]
                
                ditto tpl:
                [+phx:input=`[[multiTV? &tvName=`files` &docid=`[+id+]` &outerTpl=`tech-multiTV-wrapper` &rowTpl=`tech-multiTV-row`]]`:outer=`
                <a name="anchor[+id+]"></a>
                <h2><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a></h2>
                `+]
                
                multiTV wrapper:
                <ul>
                [+wrapper+]
                </ul>
                
                multiTV row:
                <li><a href="[+pdf+]" title="[+title+]" target="blank">[+title+]</a></li>



                2 Using Ditto and MultiTV together to insert a sub menu that jumps to the relevant anchor on a page:

                ditto call:
                <ul>[[Ditto? id=`content[*id*]` &startID=`128` &depth=`0` &showInMenuOnly=`1` &tpl=`anchor-menu-row` &orderBy=`pagetitle ASC` ]]</ul>
                
                ditto tpl:
                [+phx:input=`[[multiTV? &tvName=`files` &docid=`[+id+]` &outerTpl=`anchor-multiTV-wrapper` &rowTpl=`anchor-multiTV-row`]]`:outer=`<li><a href="#anchor[+id+]" title="[+pagetitle+]">[+pagetitle+]</a></li>`+]
                
                multiTV wrapper:
                <span class="hide">[+wrapper+]</span>
                
                multiTV row:
                -
                
                Notes:
                
                a This requires Jako's phx outer snippet
                <?php
                /*
                * description: surround not empty string with text
                * usage: [+string:outer=`before|after`+]
                */
                
                $options = explode("|", $options);
                if (count($options) == 1) {
                    $options[1] = '';
                }
                if (trim($output) != '') {
                    return $options[0].$output.$options[1];
                } else {
                    return '';
                }
                ;
                ?>
                
                b I setup a css class called hide with display:none to hide the multiTV row output ( the dashes '-' )



                3 Using MultiTV to insert multiple pdfs from one resource directly on that page:

                multiTV call:
                [!multiTV?
                &tvName=`files`
                &docid=`[*id*]`
                &outerTpl=`pdfs-wrapper`
                &rowTpl=`pdfs-row`
                !]
                
                multiTV wrapper:
                <a name="anchorTech"></a>
                <h2>PDFs</h2>
                <ul>
                [+wrapper+]
                </ul>
                
                multiTV row:
                <li><a href="[+pdf+]" title="[+title+]" target="blank">[+title+]</a></li>
                


                4 Using MultiTV values in a PHx "if not empty" style to insert a button ONLY if the MultiTV is empty. I put this in a chunk and then directly in a template:

                [*phx:multitvisempty=`files`:then=``:else=`{{button-PDF}}`*]
                
                (this should also work in the opposite: [*phx:multitvisnotempty=`files`:then=`{{button-PDF}}`:else=``*] )
                
                Notes:
                
                a This requires Jako's 2 custom phx modifiers (multitvisempty.phx.php and multitvisnotempty.phx.php)
                to be uploaded to: /assets/plugins/phx/modifiers
                


                Best of luck.
                [ed. note: nickf08 last edited this post 14 years, 3 months ago.]
                  Web design Adelaide
                  http://gocreate.com.au
                  • 13428 ☆ A M B ☆
                  • 1,031 Posts
                  Thank you for the 'flowers' smiley


                  In the document template (or in document content) you could remove |[*id*] in the PHx modifier options since it defaults to the current document. It is needed i.e. in Ditto template chunks.

                  If you want to work with thumbnails in multiTV you could use the PHx phpthumb modifier. So you could use different thumbnail sizes (and other effects) in each multiTV call i.e. in Ditto a small thumb for the first image as teaserimage, in the document itself a midsize image in the content linked to the large image as inline popup with colorbox.
                    • 21417
                    • 486 Posts
                    Thank you for the tips Jako.
                      Web design Adelaide
                      http://gocreate.com.au
                      • 38630
                      • 21 Posts
                      Sorry to hijack your old thread but the the solution you made is very close to what I am need, but I can't quite understand the final output requirements.

                      I have a dropdown multiTV element on a page which is populated with an @SELECT query which lists resources in a specific folder. That works correctly but what I am having difficulty with is retrieving those resources for output. The resources have TVs included which I need to output as well.

                      Can you point me in the right direction of what I need to do?

                      Thanks