Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

Filtering resources with template variables - MODx

While creating my blog, the need for my readers to be able to filter my post with some specified tags became a challenge. This can be likened to tags in some other blogs.

Below was how I figured it out:

Create your template variables with "||" separating them as explained below:

I choose radio option for the input type because my posts are mutually exculsive (one post can't have same tag).

Here is your Ditto definition and the usage of filter parameter to solve this:

&filter=`type_of_post,article,1`, where "article" is the tag you defined in your template variable and It is case sensitive. If you have space between the tags and your separator (||), you also have to include the space in your filter tag.

For reference on how filter parameter of Ditto works, you can read more from this link: Ditto filter parameter can do far more complex comparison things, ranging from simple "equal to" to "contains" comparison.

I hope this has saved someone some energy.

Catch yaaa!

comments powered by Disqus