Jump to content

Help with modulus operator


scarhand

Recommended Posts

I want to use a conditional statement that adds a line break every 15 posts.

 

Example:

 

post 1
post 2
post 3
post 4
post 5
post 6
post 7
post 8
post 9
post 10
post 11
post 12
post 13
post 14
post 15
<br /> <- added via modulus or w/e
post 16
post 17
post 18
post 19
post 20
post 21
post 22
post 23
post 24
post 25
post 26
post 27
post 28
post 29
post 30
<br /> <- added via modulus or w/e
post 31
post 32

 

I've tried using:

 

If ($postcount % 15)
  echo '<br />';

 

Maybe I'm not totally grasping the operator. Could someone tell me the proper way to accomplish this?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.