3

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

{gallery}
  <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}
  </li>
{/gallery}

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>

  <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>
</ul>

Notice that the classes get output two three one two

not

one two three

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

6

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

https://support.ellislab.com/bugs/detail/19871

| improve this answer | |
  • Hi Kevin, For me the line was 294, not 315 as in the bug report. But regardless bug fixed. – CreateSean Nov 2 '13 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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