I'm building out a photo gallery using the grid field type and everything works fine with this code:

  <li class="{gallery:switch='one|two|three'}">
    <a href="{gallery:photo}"><img src="{gallery:photo:square}" alt="{gallery:caption}" /></a>

    {if gallery:caption}<h5>{gallery:caption}</h5>{/if}

However the switch tag is outputting the classes in the wrong order which is why I changed them to numbers, really they should be clear||last. The unexpeced output is here:

<ul id="gallery">
  <li class="two">
    <a href="http://domain.com/uploads/gallery/test16.jpg"><img src="http://domain.com/uploads/gallery/_square/test16.jpg" alt=""></a>


  <li class="three">
    <a href="http://domain.com/uploads/gallery/test15.jpg"><img src="http://domain.com/uploads/gallery/_square/test15.jpg" alt="Mmm Caffeine!"></a>

    <h5>Mmm Caffeine!</h5>          </li>

  <li class="one">
    <a href="http://domain.com/uploads/gallery/test12.jpg"><img src="http://domain.com/uploads/gallery/_square/test12.jpg" alt="Marshmallows!"></a>

    <h5>Marshmallows!</h5>          </li>

  <li class="two">
    <a href="http://domain.com/uploads/gallery/test5.jpg"><img src="http://domain.com/uploads/gallery/_square/test5.jpg" alt="Be Careful"></a>

    <h5>Be Careful</h5>          </li>

Notice that the classes get output two three one two


one two three

Any idea why this is happening or how to fix it?

1 Answer 1


It looks like you found a bug, Sean, sorry you got bitten by it. I've reported it and posted a fix here:


  • Hi Kevin, For me the line was 294, not 315 as in the bug report. But regardless bug fixed.
    – CreateSean
    Commented Nov 2, 2013 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.