Jump to main content Jump to doc navigation

getResourcesTag Snippet

This snippet displays the results from a tag link generated by the tagLister snippet.

Usage

Simply place the snippet wherever you would like to display tag-driven Resource lists.

[[!getResourcesTag? &parents=`4,12,33` &tpl=`tag_result`]]

See the Examples section below.

Available Properties

getResourcesTag is a wrapper snippet around getResources, so all the properties in getResources are also available to getResourcesTag, as well as the following:

Name Description Default
tagKey The TV to filter by. tags
tagRequestParam The REQUEST parameter to use for the tag filter. tag
grSnippet The snippet to wrap with getResourcesTag. Recommended to leave at getPage. getPage

Common Properties from getResources

Remember: all properties from getResources are fair game as arguments to getResourcesTag, but in practical usage, you'll probably focus on the following:

Name Description
tpl Name of a chunk serving as a resource template. If not provided, properties are dumped to output for each resource
tplOdd Name of a chunk serving as resource template for resources with an odd idx value (see idx property)
tplFirst Name of a chunk serving as resource template for the first resource
tplLast Name of a chunk serving as resource template for the last resource
sortby Any Resource Field (excluding Template Variables) to sort by. Some common fields to sort on are publishedon, menuindex, pagetitle etc, but see the Resources documentation for all fields. Specify fields with the name only, not using the tag syntax.

Examples

Display Resources with tag 'test' (found in the GET param 'tag') in the TV 'blog-tags', and set the results to a placeholder called 'results':

[[!getResourcesTag? &parents=`4,12,33` &tagKey=`blog-tags` &toPlaceholder=`results` &tpl=`tag_result`]]

<h2>Search Results</h2>

<ul>
[[!+results]]
</ul>

Where tag_result is a Chunk containing the following:

<li>
<a href="[[~[[+id]]]]">[[+pagetitle]]</a>
</li>

See Also

  1. tagLister.getResourcesTag
  2. tagLister.tagLister
    1. tagLister.tagLister.all
    2. tagLister.tagLister.tpl
  3. tagLister.tolinks
    1. tagLister.tolinks.tpl

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • Chris Fickling
  • CrewMark
  • deJaya
  • eydolan
  • Following Sea
  • Lefthandmedia
  • Murray Wood
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • Nick Clark
  • A. Moreno
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$311 per month—let's make that $500!

Learn more