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

    I’ve been using MODx for quite a while. Since about Evo 1.0.4 or something. Anyway, I’m now happily using Revo, and all is good.

    I’m trying to use some TVs with getResources. I always seem to have a problem with TVs, but get there in the end.

    Anyway - Here’s what I have...

    My Chunk:

    <div class="item [[*tv.portfolio-class]]">
    <a href="#[[+longtitle]]" class="mosaic-overlay popup">
    <div class="details">
    <h4>[[+pagetitle]]</h4>
    <p>[[+description]]</p>
    <p class="more-info">More Info</p>
    </div>
    </a>
    <img src="[[*tv.portfolio-thumb]]" alt="[[+pagetitle]]" /></div>


    And my gR call:

    [[!getResources? &parents=`2` &includeContent=`1` &includeTVs=`1` processTVs=`1` &limit=`11` &tpl=`portfolio`]]


    All of the resources specific placeholders are working (pagetitle, description etc) but the TVs aren’t. tv.portfolio-thumb is a straightforward image, and tv.portfolio-class is a checkbox list (hoping to output a list of string with &nbsp; and a delimiter, hope that will work!)

    Any ideas why its not working?

    Thanks
      • 8609
      • 607 Posts
      Syntax: [[+tv.portfolio-class]] not [[*tv.portfolio-class]] wink
        • 21122
        • 153 Posts
        Haha - I’m pretty sure I’ve asked the same question before, and you’ve responded with that exact same answer!

        However, I’m wise to this now, and altering to ’+’ instead of ’*’ makes no difference!
          • 21122
          • 153 Posts
          When I add &debug=`true` to my getResources call, it displays this in my erro log:

           [2011-06-29 14:30:31] (ERROR @ /index.php) SELECT `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override` FROM `modx_site_content` AS `modResource` WHERE  (  ( modResource.parent IN (2,7,8,9,10,11,12,13,14,15,16,17) AND (modResource.context_key IN ('web') OR EXISTS(SELECT 1 FROM `modx_context_resource` ctx WHERE ctx.resource = modResource.id AND ctx.context_key IN ('web'))) )  AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`hidemenu` = 0 )  ORDER BY publishedon DESC LIMIT 11 


          But I’m damned if I know what the hell that means!
            • 21122
            • 153 Posts
            You madam, are a genius (or you just have very good eyesight!)

            Thanks all the same, I owe you one!
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The difference between [[* and [[+ is subtle, but quite serious. + is a placeholder (as you know) but it is created by the snippet and when used in the context of generating a list from a set of resources, this placeholder is created and applied for each resource in the set as the snippet works through the set of resources. So the value of the placeholder will be the value applicable to each item of the set.

              On the other hand, * is a resource or template variable (again, as you know). The significant difference it that it always applies to only one resource - the resource MODx is currently processing.

              For example, if you have a News page with a list of news item summaries, [[*pagetitle]] will always apply to the pagetitle of the News page itself. So if you have [[*pagetitle]] in your getResources (or [*pagetitle*] in Ditto for Evo) it will be the News resource’s pagetitle in each summary in the list.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org