PDA

View Full Version : Simple Conditional Request Please?


Okiewan
12-13-2004, 01:30 PM
Okay...

This conditional inserts code after each first post in a thread.
What I'd like to do is modify it, to add another piece of code a few posts down in the same thread. Ie; "insert after first post, then insert after 6th post"

Or... after EVERY "x"th reply in a thread.

The current conditional:

<if condition="$post[postid] == $GLOBALS['FIRSTPOSTID']">

Any help? Thanks in advance!

Andrew
12-13-2004, 01:55 PM
Okay...

This conditional inserts code after each first post in a thread.
What I'd like to do is modify it, to add another piece of code a few posts down in the same thread. Ie; "insert after first post, then insert after 6th post"

Or... after EVERY "x"th reply in a thread.

The current conditional:

<if condition="$post[postid] == $GLOBALS['FIRSTPOSTID']">

Any help? Thanks in advance!
I know in java I'd use the mod function like the following :
<if condition="($post[postid]%6) == 0">
That would display it for any post ID that was evenly divisible by 6. I would assume PHP has a mod function as well but I'm not sure if the operator is the same (%).

Okiewan
12-13-2004, 02:11 PM
Thanks for the reply... your sugestion does work, showing the inserted code every 6 posts, question is how to I join the two? Example; "insert after first post, then after each 6th post?
Thanks again.

Andrew
12-13-2004, 07:42 PM
Try this one which should work for both cases :
<if condition="($post[postid] == $GLOBALS['FIRSTPOSTID']) or (($post[postid]%6) == 0)">