I was wondering how do i pass URL variables into a snippet when doing a call like this
[ [mySnippet? &width=`100` &height=`300` ] ]
so basically width and height will be passed as
index.php?width=200&height=100
-
MODX Staff
- 10,725 Posts
$_GET and $_POST variables work in MODx like they would in any PHP site, though you must not cache snippets that must use them dynamically. You would not explicitly pass them in the snippet call.
-
MODX Staff
- 10,725 Posts
You caching it? Also, $modx->clearCache() is meaningless TBH; no need to use it. You need to make the page non-cacheable or call the snippet with non-cacheable tags, i.e. [!Snippet!] vs. [[Snippet]].
It was the caching issue. Thanks so much