Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Setting a different css class for the first topic

It doesn’t have to know the difference. You set

$special

to be a special class before the loop, then the last thing you do in the loop is set

$special

to be something else. So the first time round the loop

$special

has it’s original value, then at the end of the first loop it’s value is changed (so it’s no longer the initial value).

The fact that the value is repeatedly reset to the other value is irrelevant (there is overhead in this, but it’s comparable to calling a function each time round the loop to check for “is this the first item” and it has the advantage that it’s not API specific.

Skip to toolbar