Hi all, this is my first post, so I'll try to be as articulate as possible.
I'm working on developing a jQuery mobile webpage using ModX, and I've run in to a bit of a mind-bender.
I need to display Thumbnail images for certain items in a menu that is being generated using wayfinder. jQueryMobile automatically grabs image tags out of a <li> item and styles them accordingly, so I went ahead and made a thumbnail TV and added it into the innerRow chunk of my wayfinder setup.
This works great. The img tag only shows up when I have selected an thumbnail image in the document template, and jQueryMobile resizes the image automatically.
Except:
The image is resized, not cropped. With many thumbnails in the list, the page will have to load all full size images. Not ideal.
So, I installed phpThumbOf, and added the modifier to the original thumb TV to crop the images to the correct size. However, because phpThumbOf needs to be fed text as the TV output, I have to add an img tag in the wayfinder chunk. This means that the items with thumbnails are displaying nicely cropped images, but all wayfinder items that are calling my innerRow chunk are outputting empty img tags. These tags are then detected by jQueryMobile and change the formatting.
How can I call an image using a TV into a wayfinder menu, modify it so that it is cropped, but only call image tags to display it when there is an image in the TV (or strip them when there is not?). I have looked at I/O modifiers, but they do not seem to help because I would need to edit the code outside of the tag, not in it.
I have tried embedding the thumbnail TV and phpThumbOf in a chunk, so that I could modify the chunk using I/O modifiers, but this kills the TV.
Pretty stumped here, thanks for any help!
-
☆ A M B ☆
- 24,524 Posts
Use an output filter in your chunk tpl so that it only generates the img tags if there is an image path. (I presume this is Revo; if it's Evo you'll need to install the PHx plugin since Wayfinder doesn't include it like Ditto and Jot do).
http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29