ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Query exp_members and dynamically add class depending on row and col

October 25, 2013 4:32am

Subscribe [2]
  • #1 / Oct 25, 2013 4:32am

    J-man

    1 posts

    Hello,

    On my EE2 site I have a photo section where I query all memberphotos from exp_members and put them in an ul.

    I wonder if it’s possible to dynamically add a class to each li-element depending on row and col?
    I have four rows and six cols with li-elements. I would like the first li to get the class “row-one col-one” and the next li “row-one col-2” etc…

    Is this possible to accomplish in EE2 or do I have to use javascript?

    Thanks / J

  • #2 / Oct 29, 2013 11:52am

    Ralph

    78 posts

    Try using switch= and the Math add-on a bit like this (untested!)

    <li class="row-{exp:math formula='{count}/6' decimals='0' round='down'} col-{switch='1|2|3|4|5|6'}"}
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases