getArchives
Last updated Mar 6th, 2021 | Page history | Improve this page | Report an issue
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
Budget
$301 per month—let's make that $500!
Learn moregetArchives Snippet¶
This snippet displays the results from an archive link generated by the Archivist snippet.
Usage¶
Simply place the snippet wherever you would like to display archives. getArchives will automatically handle the FURLs and input from the Archivist snippet call.
[[!getArchives? &parents=`4,12,33`]]
If using with getPage, make sure to set &cache=0
on the getPage call.
Available Properties¶
getArchives is a variant of getResources, so all the properties in getResources are also available to getArchives, as well as the following:
Name | Description | Default |
---|---|---|
tpl | Name of a chunk serving as a resource template. | |
parents | Comma-delimited list of ids serving as parents. | |
filterField | The field to use to filter by when filtering by archives. Make sure this is the same as the sortBy parameter on the Archivist snippet call. | publishedon |
filterPrefix | The prefix to use for GET parameters with the Archivist links. Make sure this is the same as the filterPrefix parameter on the getArchives snippet call. | arc_ |
tagsIndex | If set, and a REQUEST var of this index is found, will automatically filter results by the value. | tags |
toPlaceholder | If set, will set the output of this snippet to this placeholder rather than output it. |
If your getArchives call is not displaying any results and your resources are hidden from menus, make sure you specify the &showHidden=1
parameter (inherited from getResource) parameter!
getArchives Chunks¶
There is 1 chunk that is processed in getArchives. Its corresponding getArchives parameter is:
- tpl - The Chunk to use for each result displayed.
Examples¶
Display archives for parents 4, 12 and 33, and set the results to a placeholder called 'results':
[[!getArchives? &parents=`4,12,33` &toPlaceholder=`results`]]
<h2>Search Results</h2>
[[!+results]]