Skip to content

Instantly share code, notes, and snippets.

@pepebe
Forked from opengeek/optimized.html
Last active October 11, 2015 05:57
Show Gist options
  • Save pepebe/3813594 to your computer and use it in GitHub Desktop.
Save pepebe/3813594 to your computer and use it in GitHub Desktop.
Example of optimizing conditional filters using a Chunk wrapper
[[[[*page-image:notempty=`$wrapImgThumb?
&src=`*page-image`
&alt=`[[*pagetitle]]`
&thumbOpts=`w=480&h=320`
`]]]]
[[*page-image:notempty=`
<img
src="[[*page-image:phpthumbof=`w=480h=320`]]"
alt="[[*pagetitle]]"
/>
`]]
<img src="[[[[+src]]:phpthumbof=`[[+thumbOpts]]`]]" alt="[[+alt]]" />
@pepebe
Copy link
Author

pepebe commented Oct 1, 2012

Technique proposed by Jason Coward

Use this technique to prevent MODX from parsing all tags in a conditional.
For further understanding read this: http://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/

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