We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7113
    • 27 Posts
    How do i use get to display

    1 - one resource/document title

    2 - display one resource’s intro text/summary
      • 7914
      • 137 Posts
      I used this chunk for my news "home" page. This is the chunk that repeats with a "read more" link. You can see how I used the page title and introtext.
      <div class="article">
      		<h2 class="news-title"><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h2>		
      		<p class="post-info">Posted on [[+publishedon:strtotime:date=`%b %d, %Y`]]</p>
      		
      		<div class="news-entry">
      			<p>[[+introtext]]</p>
      		</div>
      		
      		<p class="postmeta"><a href="[[~[[+id]]]]" class="readmore">Read more</a></p>
      </div>
      
        • 7113
        • 27 Posts
        Thanks,

        How do you specify a resource ID if you want a particular resource to be displayed
          • 30585
          • 833 Posts
          Quote from: derelin at Oct 13, 2010, 11:20 PM

          Thanks,

          How do you specify a resource ID if you want a particular resource to be displayed

          Your question wasn’t very clear, but let’s give it a try.

          There are many ways to achieve this.

          You can use this call:

          [[!getResourcesTag? &elementClass=`modSnippet` &element=`getResources` &tpl=`yourtpl` &parents=`id` &limit=`1` &includeContent=`1` &includeTVs=`1` &showHidden=`0` &hideContainers=`0` &cache=`0` &pageVarKey=`page` ]]

          Make sure that the document you’d like to retrieve is a container and place no other documents within it.

          Notice that I set &hideContainers to =`0`. This is required for the trick to work. I other words, the container document will be displayed.

          For more, I recommend reading the Wiki http://rtfm.modx.com/display/ADDON/getResources

          Hope t helps
            A MODx Fanatic
            • 7113
            • 27 Posts
            Thanks for the response. The example you give requires a container, what if the item i want to display is not a container but a resource on the first level?

            What i want to display is something like this;

            First part
            A list in which i define two specific items to be displayed

            Article story1 title
            Article story2 title



            But instead of fetching it from the container, I want to show the title of that item,

            The second part is;
            Think of a situation with a site that has these resources and IDs;
            Home(1)
            About(2)
            Contact(3)

            I want to show a summary of "About" so that when someone clicks "Read More", they can read teh full details.
            That means that i should be able to display the summary of "About" only. How would i implement that? Do i call an ID? and if so, where do i place the ID?

              • 30585
              • 833 Posts
              On which page do you wantthe summary displayed?
                A MODx Fanatic
                • 10107
                • 24 Posts
                Quote from: derelin at Oct 14, 2010, 03:08 PM

                Thanks for the response. The example you give requires a container, what if the item i want to display is not a container but a resource on the first level?

                What i want to display is something like this;

                First part
                A list in which i define two specific items to be displayed

                Article story1 title
                Article story2 title



                But instead of fetching it from the container, I want to show the title of that item,

                The second part is;
                Think of a situation with a site that has these resources and IDs;
                Home(1)
                About(2)
                Contact(3)

                I want to show a summary of "About" so that when someone clicks "Read More", they can read teh full details.
                That means that i should be able to display the summary of "About" only. How would i implement that? Do i call an ID? and if so, where do i place the ID?



                To answer the second part of your question you can specify an id in the getResources call and limit it to 1 so add:

                [[!getresources? &idx=`2` &limit=`1`]]

                and whatever other params you need
                  • 7113
                  • 27 Posts
                  Quote from: treigh at Oct 14, 2010, 03:31 PM

                  On which page do you wantthe summary displayed?

                  I want to place the tag within a template, so that wherever the template appears, the tag is used to show that specific list or intro.
                    • 7113
                    • 27 Posts
                    Also, why does this list get output as part of content

                    Array
                    (
                    [tpl] =>
                    [tplOdd] =>
                    [tplFirst] =>
                    [tplLast] =>
                    [sortby] => publishedon
                    [sortbyTV] =>
                    [sortbyAlias] =>
                    [sortbyEscaped] => 0
                    [sortdir] => DESC
                    [sortdirTV] => DESC
                    [limit] => 1
                    [offset] => 0
                    [tvFilters] =>
                    [depth] => 10
                    [parents] => 5
                    [includeContent] => 1
                    [includeTVs] =>
                    [showHidden] =>
                    [showUnpublished] =>
                    [showDeleted] =>
                    [resources] =>
                    [processTVs] =>
                    [tvPrefix] => tv.
                    [idx] => 1
                    [first] => 1
                    [last] => 1
                    [toPlaceholder] =>
                    [debug] =>
                    [extenders] => summary
                    [id] => 6
                    [type] => document
                    [contentType] => text/html
                    [pagetitle] => Terms
                    [longtitle] =>
                    [description] =>
                    [alias] => terms
                    [link_attributes] =>
                    [published] => 1
                    [pub_date] => 0
                    [unpub_date] => 0
                    [parent] => 5
                    [isfolder] =>
                    [introtext] =>
                    [content] =>
                    


                    I used parameters like this

                    [[!getResources? &parents=`5` &limit=`1` &includeContent=`1` &extenders=`summary`]]
                      • 28215
                      • 4,149 Posts
                      1. You need to specify a &tpl property with the name of your Chunk you’re using.
                      2. &extenders is not a getResources property.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com