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.
$305 per month—let's make that $500!Learn more
Converts a delimited list into a list of linkable tags: typically, this would be used on a page that has been tagged with various taxonomical tags and you want to link to other pages that have been tagged by those same tags. For an example, see https://forums.modx.com/index.php/topic,61744.0/topicseen.html
tolinks is called with the normal snippet tag, passing in an 'items' property as the list of items to convert; a 'target' property for the Resource to generate links to; and a 'key' property for the name of the GET param being generated on each link.
|Name||Example usage||Description||Default Value|
||The items to turn into links.|
||Name of a Chunk that will be used for each result.||link|
||The ID of the Resource that links will point to.||1|
||The delimiter that is used on the items property. Defaults to a comma.||,|
||The delimiter that separates the links that are outputted. Defaults to a comma.||,|
||The REQUEST var key that will be used in generating the links.||tag|
||Name of a CSS class to add to each result.||tl-tag|
||If set, will set the output of this snippet to this placeholder rather than output it.||false|
||Is set to 1, this will force full links to each tag.||false|
||tag group name, used in generating links||tags|
||sets the GET var key|
outputs http://f.qdn.com/somepage?MyCustomVar=articlestags&tag=theTag\\ | key |
There is 1 chunk that is processed in tolinks. Its corresponding parameters are:
- tpl - The Chunk to use for each link generated.
Change the TV value of 'tags' into links that point to the URL of Resource 123 with the GET param of 'tag':
[[!tolinks? &items=`[[*tags]]` &key=`tag` &target=`123`]]
toLinks will generate relative URLs to the resource indicated by the &target parameter, so if you are having trouble getting the links to point to the correct URL, add a Chunk containing something like the following for use by the &tpl parameter:
Alternatively, set the &useTagsFurl property.
The resource ID referenced by the &target parameter should contain something like the following that lists the posts tagged:
[[!getResourcesTag? &element=`getResources` &elementClass=`modSnippet` &tpl=`blogPost` &hideContainers=`1` &pageVarKey=`page` &parents=`59` &includeTVs=`1` &includeContent=`1` ]] [[!+page.nav:notempty=` [[!+page.nav]] `]]