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

    I'm thinking i can achieve this with getResources but there may be a better way to do it so apologies if this is in trhe incorrect board.

    I want to create a featured article to appear on the home page. This article will be chosen from an existing article in the 'Articles' container.
    I have a TV called 'featuredTV' with input options of 'Resource List' and i've set the Parents input option to my Articles container ID...works fine i now have a resource with a tv dropdown list of all my articles.
    I have my getResources call already to display the 2 latest articles so i thought i could add another getResources call to display the article chosen from the dropdown list but that's where i'm stuck.. how do i get the chosen article to display, i'm not sure what parameters i'd use?

    Using modx2.2.4

    Thanks for any pointers

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I think this example from http://rtfm.modx.com/display/ADDON/getResources will do the trick; just replace the &parents value with the parent of your list, and replace the &resources value with your TV's tags.

      [[!getResources? &parents=`-1` &resources=`10,11,12` &tpl=`myRowTpl`]]
        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
        • 41613
        • 8 Posts
        Hi Sottwell,

        Sorry for the delayed response!!
        Thanks for your suggestion. This does actually display something but it seems like the paths are wrong.
        My chunk is:
        <article class="four columns alpha">
        <img src="phpThumb/phpThumb.php?src=../[[+article-summary-image]]&w=200&h=130&zc=1" alt="" />
        <div class="inner-sides">
        		<div>[[+publishedon:strtotime:date=`%b.%d.%Y`]]</div>
        		<h3><a href="[[~[[+id]]]]" title="">[[+pagetitle]]</a></h3>
        		<p>[[+introtext:default=`[[+content:ellipsis=`400`]]`]]
        <a href="[[~[[+id]]]]" title="">READ MORE</a></p>
        </div>
        </article>


        but the title...
        [[~[[+id]]]]
        ...displays the title of my resource that contains the dropdown tv (i.e. Featured News), the date displays an incorrect date and the image just literally displays the code (as above) in the source code.
        So clearly the chunk is being read but not the TV

        so my getResources call is:
        [[!getResources? &parents=`42` &resources=`252` &tpl=`articleHome-featured` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` &limit=`1`]]


        where #252 has my dropdown TV list of articles.

        Any ideas why it's still not working?

        Thanks for any help
        [ed. note: geronimo171 last edited this post 13 years, 11 months ago.]
          • 36624
          • 535 Posts
          it's not working because you didn't do what susan suggest.

          on your home page your call should be :

          [[!getResources? &parents=`-1` &resources=`[[*featuredTV]]` &tpl=`articleHome-featured` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` ]]

          [[*featuredTV]] should be a delimited list of ID's (12,13,14,...) so check the output type of the tv.
            CTRL+SHIFT+U - Clear Cache
            CTRL+SHIFT+H - Hiding Heft Panel
            CTRL+SHIFT+N - Fast Create Resource
            CTRL+ALT+P - Preview Recource (in edit resorce window)
            CTRL+ALT+S - Save