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

    I have just started to use multiTV (https://github.com/Jako/multiTV) and I am stuck.

    I am wanting to use multiTV in 2 different instances on each page:
    1. to attach multiple pdfs to a page.
    2. to attach multiple images to a page.

    For some reason the file ‘type’ TV does not work for me – I can choose a pdf to insert with the FCK editor (or whatever it is called) but nothing gets entered into the file form field.

    I have created a config file called “files.config.inc.php” and edited the original “images.config.inc.php” (below and attached) but viewing the page in the browser shows the source code breaks:

    files.config.inc.php =
    <?php
    $settings['display'] = 'vertical';
    $settings['fields'] = array(
    	'pdf' => array(
    		'caption' => 'PDF',
    		'type' => 'file'
    	),
    	'title' => array(
    		'caption' => 'Title',
    		'type' => 'text'
    	)
    );
    ?>


    images.config.inc.php =
    <?php
    $settings['display'] = 'vertical';
    $settings['fields'] = array(
    	'image' => array(
    		'caption' => 'Image',
    		'type' => 'image'
    	),
    	'thumb' => array(
    		'caption' => 'Thumbnail',
    		'type' => 'thumb',
    		'thumbof' => 'image'
    	),
    	'title' => array(
    		'caption' => 'Title',
    		'type' => 'text'
    	)
    );
    $settings['templates'] = array(
    	'outerTpl' => '<h2>Photos</h2><div class="thumbBox">[+wrapper+]</div>',
    	'rowTpl' => '<a href="[+image+]" title="[+title+]" class="ga11ery th" rel="photos"><img src="[+thumb+]" class="thumbImg" alt="photo" /></a>'
    		)
    ?>



    Broken code in the browser view source =
    <h2>TEST MULTI PDF</h2><ul> <li><a titl <li><a titl</ul>
    And
    <h2>Testing MultiTV Photos</h2><div clas


    Images snippet call =
    [!multiTV?
    &tvName=`images`
    &docid=`[*id*]`
    &outerTpl=`@CODE <h2>Testing MultiTV Photos</h2><div class="thumbBox">((wrapper))</div>`
    &rowTpl=`@CODE <a href="((image))" title="((title))" class="ga11ery th" rel="photos"><img src="((thumb))" class="thumbImg" alt="photo" /></a>`
    &display=`5`
    &rows=`all`
    &toPlaceholder=`0`
    !]


    FILES snippet call =
    [!multiTV?
    &tvName=`files`
    &docid=`[*id*]`
    &outerTpl=`@CODE <h2>TEST MULTI PDF</h2><ul>((wrapper))</ul>`
    &rowTpl=`@CODE <li><a title="((title))" href="((pdf))" target="blank">((title)) ((image))</a></li>`
    &display=`5`
    &rows=`all`
    &toPlaceholder=`0`
    !]


    Both inserted in the template as chunks (which looks to be ok as it works for the event” demo in the same template).

    Any ideas? Am I missing something obvious?

    Any help greatly appreciated as if I can get this working, this will be perfect for a current project.

    With the images option, how do I get the thumbs generated automatically like with Multi-ImageTV?

    Many thanks in advance. [ed. note: nickf08 last edited this post 14 years, 4 months ago.]
      Web design Adelaide
      http://gocreate.com.au
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      Hi Nick,

      please tryout the current release of multiTV. If there are issues, use the github issue tracker.
        • 21417
        • 486 Posts
        Hi Jako,

        Thanks. I have tried the current release but am unable to get it working. I think there may be an issue with the file manager / image manager path so I raised an issue on GitHub.

        When I am editing a resource in the MODx manager, and click the "insert" button for the multiTV, instead of opening the MODx file manager, the browser window is redirected to an external website with address "http://www.manager.com/".

        The same thing happens when I use the default images config supplied with the package.

        Any ideas? [ed. note: nickf08 last edited this post 14 years, 4 months ago.]
          Web design Adelaide
          http://gocreate.com.au
          • 21417
          • 486 Posts
          The page layout still gets broken with the new version on GitHub.

          In using the default images config the page source still returns:

          <h2>Testing MultiTV Photos2</h2><div clas

          [!multiTV?
          &tvName=`images`
          &docid=`[*id*]`
          &outerTpl=`@CODE <h2>Testing MultiTV Photos2</h2><div class="thumbBox">((wrapper))</div>`
          &rowTpl=`@CODE <a href="((image))" title="((title))" class="ga11ery th" rel="photos"><img src="((thumb))" class="thumbImg" alt="photo" /></a>`
          &display=`5`
          &rows=`all`
          &toPlaceholder=`0`
          !]
          


          and the files config I created returns:

          <h2>TEST MULTI PDF</h2><ul> <li><a titl</ul>

          [!multiTV?
          &tvName=`files`
          &docid=`[*id*]`
          &outerTpl=`@CODE <h2>TEST MULTI PDF</h2><ul>((wrapper))</ul>`
          &rowTpl=`@CODE <li><a title="((title))" href="((pdf))" target="blank">((title)) ((image))</a></li>`
          &display=`5`
          &rows=`all`
          &toPlaceholder=`0`
          !]
          


          I will raise this as an issue on github.
            Web design Adelaide
            http://gocreate.com.au
            • 21417
            • 486 Posts
            Hi Jako,

            Is it possible to use multiTV results with ditto?

            I am trying to use it in 3 ways but without success.


            1 For files...
            (with a phx call limitng output to only those pages that have files)

            Ditto template:
            [+phx:if=`[+files+]`:is=``:then=``:else=`
            <h2><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a></h2>
            [+files+]
            <hr />
            `+]
            Ditto call is:
            [!Ditto? id=`content[*id*]` &startID=`0` &depth=`0` &showInMenuOnly=`1` &tpl=`techdata-menu2-row` &orderBy=`menuindex ASC`!]

            The ditto call is uncached on an uncached page.

            This returns the page title for all pages of the site (eg the phx does not work) and []


            2 For images...

            Ditto template:
            <li[[insertClass? &n=`[+ditto_iteration+]` &x=`3`]]><a href="[~[+id+]~]" title="[+pagetitle+]">
            <img src="[+image:phpthumb=`w=150&h=100&zc=1&q=80`+]" alt="menu image" class="mainpic" />
            <span><b>[+phx:if=`[+image-menu-txt+]`:is=``:then=`[+pagetitle+]`:else=`[+image-menu-txt+]`+]</b></span>
            </a></li>
            

            Ditto call is:
            [[Ditto? id=`imagemenu` &startID=`[*id*]` &depth=`1` &tpl=`image-boxing-menu-row` &orderBy=`menuindex ASC` &filter=`id,[*id*],2`]]

            The image returns empty (eg img src="")


            3. I am also wanting to use multiTV with PHx in a chunk in the website sidebar like so:
            [*files:isnot=``:then=`{{button-Tech}}`*]

            But this does not seem to work - it returns {{button-Tech}} regardless of whether or not a pdf has been attached to the multiTV "files" tv.


            Any ideas?

            Thanks for your help.

            Nick [ed. note: nickf08 last edited this post 14 years, 4 months ago.]
              Web design Adelaide
              http://gocreate.com.au
              • 13428 ☆ A M B ☆
              • 1,031 Posts
              You can't call the TV directly in MODX in a template chunk. The TV starts and ends with [ [ ] ], so the MODX Parser thinks it is a snippet after the TV value is inserted.

              In a Ditto template you could call it this way:
              [+phx:input=`[[multiTV? &tvName=`files` &docid=`[+id+]` &rowTpl=`xxx` &outerTpl=`yyy`]]`:outer=`<h2><a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a></h2>|
              <hr />`+]

              outer Modifier: https://github.com/Jako/PHx-Modifier/blob/master/outer.phx.php
                • 21417
                • 486 Posts
                Thanks Jako, that works great in the ditto template and returns the expected results - except that the &tplLast (eg without the hr in it) in the ditto call is not honoured for some reason - No matter what I put in there, the hr (and everything else as per the first template) is still included - very weird but that does not matter so much.

                On the same page I am having big troubles outputting a RHS submenu to scroll up / down to the relevant Ditto row with the pdfs. I can't get the pagetitle returned with the multiTV method, unless I put the pagetitle in the outer part of the phx statement, but perhaps I am getting the logic wrong? I am definitely getting confused.

                Main multiTV output in LHS column (working per your code in the post above):
                Page name 1
                pdf
                pdf 2
                Page name 2
                pdf
                pdf 2
                pdf 3
                Page name 3
                pdf
                etc

                I am aiming for a Submenu style multiTV output in RHS column:
                Page name 1
                Page name 2
                Page name 3
                etc

                Ditto call
                <h2>Jump to...</h2>
                <ul>[[Ditto? id=`content[*id*]` &startID=`0` &depth=`0` &showInMenuOnly=`1` &tpl=`techdata-menuR-row` &orderBy=`pagetitle ASC` ]]</ul>
                


                Ideal row:
                [+pdf-multi:isnot=``:then=`<li><a href="#anchor[+id+]" title="[+pagetitle+]">[+pagetitle+]</a></li>`+]
                

                I have been trying without success with a ditto row template of:
                [+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>`+]
                

                multiTV-pdf-wrapperRHS=
                [+wrapper+]

                multiTV-pdf-rowRHS =
                nbsp;
                (if I make it blank nothing is returned)

                This returns the 3 items with page titles - but also an nbsp; for each pdf which I obviously don't want.
                eg:
                <li><a href="/pagename#anchor178" title="Product 1">Product 1</a></li>nbsp;nbsp;nbsp;

                There is also a LOT of whitespace between each result - I presume because I am probably not doing this in the best way.

                I guess to confirm, I am wanting to return page level (not multiTV level) results IF multiTV files exist.

                Any ideas on how to make this work?

                Really in this instance

                Output
                <li><a href="/technical-data#anchor" title=""></a></li>


                Also what about...
                3. I am also wanting to use multiTV with PHx in a chunk in the website sidebar like so:
                [*files:isnot=``:then=`{{button-Tech}}`*]

                Is that possible


                Many thanks.



                [ed. note: nickf08 last edited this post 14 years, 4 months ago.]
                  Web design Adelaide
                  http://gocreate.com.au
                  • 13428 ☆ A M B ☆
                  • 1,031 Posts
                  You could use the PHx modifier in the current release or use the outer modifier on the wrapper placeholder of multiTV outerTpl.
                    • 21417
                    • 486 Posts
                    Thanks for all your help Jako.

                    This snippet has so much potential but I am finding it very challenging to use, particualrly given the way it interacts with PHx. For my limited technical skills it is tricky.

                    You could use the PHx modifier in the current release

                    I am sorry but I am not sure what you mean by this. I take it you are talking for the sub menu query. Are you able to provide a code example?

                    or use the outer modifier on the wrapper placeholder of multiTV outerTpl.

                    Do you mean like this (multiTV-pdf-wrapperRHS)
                    [+phx:input=`[+wrapper+]`:outer=`<li><a href="#anchor[+id+]" title="[+pagetitle+]">[+pagetitle+]</a></li>`+]


                    What do I put in the row template of multiTV (multiTV-pdf-rowRHS)?

                    I am really confused.


                    Also how about the button reveal in the side bar ONLY if files is not empty? Eg the equivalent of:
                    [*files:isnot=``:then=`{{button-Tech}}`*]


                    Thanks Jako.
                      Web design Adelaide
                      http://gocreate.com.au
                      • 13428 ☆ A M B ☆
                      • 1,031 Posts
                      In the last release I've added two PHx modifiers and updated the documentation too … think it is well described there.