Page 1 of 1

How do I show something, for every 4th entry?

Posted: Tue Jan 07, 2014 5:40 am
by simonmlewis
I need to show a vertical line after a DIV, for every four entry.
I did do it like this:

Code: Select all

      if ($count == 4 || $count == 8 || $count == 12 || $count == 16 || $count == 20 || $count == 24 || $count == 28 || $count == 32 || $count == 36 || $count == 40 || $count == 44 || $count == 48 || $count == 52 || $count == 56) { }
But now there will be a random set up to an unforeseen figure.

I've since tried this:

Code: Select all

      $count ++;
if (!{$count} % 4) {}
But it errors saying
unexpected '{'
So how do I do it? I assume the latter means is asking if $count is dividable by 4.

Re: How do I show something, for every 4th entry?

Posted: Tue Jan 07, 2014 5:54 am
by simonmlewis
Love it when I solve my own issue!

Code: Select all

if (($count % 4) == 0)
{}