Hello,
On my site, I have thumbImg as a TV with input type image and output type image. On the output type I have "grid_1" as the css class for the image. However, I have a small number of cases where I would like the css class to be "grid_2" instead. Is there a way to do this?
-
☆ A M B ☆
- 894 Posts
In what case does it need grid_2 class or is it something you need to do manually?
If you need to do it manually then you can use another TV or use MIGX for the image and class but you would still need 2 TVs.
When you use MIGX, I assume you're using GetListImages (or something in that neighborhood - I forgot the actual name)? That particular Snippet (provided by the MIGX addon) passes along [[+idx]] which goes from 0 to the length of your image stack (minus 1, since it's an array).
Thus, first is 0, second is 1, third is 2 and so forth. You can create an if statement for that particular rule. Naturally, you can create another field names classname via MIGX and default it to be empty. Simply place a notempty filter on that placeholder for future use inside your loop template (Chunk or @CODE,@INCLUDE ect) that says [[+class:notempty=`class="[[+class]]"`]] or when you already have a class filled with a classname do class="your classes [[+class]]".
That should solve your problem, if I interpreted your question correctly.
@MarkGHErnst
Developer at Adwise Internetmarketing, the Netherlands.