Skip to content

Instantly share code, notes, and snippets.

@aayushsapkota
Last active April 16, 2020 14:10
Show Gist options
  • Save aayushsapkota/c1ccd886ff3ec92034c0932df48d5655 to your computer and use it in GitHub Desktop.
Save aayushsapkota/c1ccd886ff3ec92034c0932df48d5655 to your computer and use it in GitHub Desktop.
Modx codes

Return the pagetitle from the resource with id 123: [[#123.pagetitle]]

Return the introtext of a parent of a current resource and display description for empty one: [[#[[*parent]].introtext:default=[[#[[*parent]].description]]]]

Or, more efficiently (see this MODX blog article): [[[[#[[*parent]].introtext:default=#[[*parent]].description]]]]

Return the content of the resources in rowTpl chunk while Wayfinder usage: [[#[[+wf.docid]].content]]

Return TV image from the resource with id 10: [[#10.tv.image]]

Return property articlesPerPage from the resource with id 1 of custom resource type Articles [[#1.properties.articles.articlesPerPage]]

Return the value of $_POST['myVar']: [[!#post.myVar]]

[[!getImageList? &tvname=image &tpl=newsImage &limit=1 &docid=[[+id]] ]]

//docid is like a resource id //set limit 0 to get unlimited items

[[!pdoResources? &parents=[[*id]] &resources= &tpl= &tvPrefix= &includeTVs= &processTVs=`` &limit=0 &depth=`0` ]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment