PDA

View Full Version : making an if statment in postbit


ranger2kxlt
01-20-2005, 03:54 PM
I need to make this

$post['postcount'] == 1 equal more then the first post

$post['postcount'] ==1,2,3 doesn't work, how do i require more then one postcount besides creating a whole new IF statment for each postcount?

Thanks

sabret00the
01-20-2005, 04:09 PM
<if condition="$post[postcount] >= 1">

ranger2kxlt
01-20-2005, 04:39 PM
Sorry my example may be off a bit need something that i can choose each postbit

$post['postcount'] == 1,6,10,50

Not all of them ;-)

I guess it has to be

$post['postcount'] == 1 | $post['postcount'] == 6 | etc.....

is that correct?

Marco van Herwaarden
01-20-2005, 06:00 PM
why not set something in your php script.

if ($var == 1 OR $var == 6 ......)
{
$postcountspecial = 1;
}

then in template just test this 1 var.

ranger2kxlt
01-20-2005, 06:20 PM
Well this is in a template thats why.

Zachery
01-20-2005, 06:40 PM
Well this is in a template thats why.
<if condition="in_array($post[postcount], array(X,Y,Z))"> special post <else /> not special post </if>

Marco van Herwaarden
01-20-2005, 06:42 PM
Yes but you could make the if statement in the script that loads the template, then just a single if statement in the template, based on a var set in the php.

Think i have seen OR like if's in templates once, but i don't remember in which one anymore

Zachery
01-20-2005, 06:43 PM
Yes but you could make the if statement in the script that loads the template, then just a single if statement in the template, based on a var set in the php.

Think i have seen OR like if's in templates once, but i don't remember in which one anymore
or works as well

<if condition="$var OR $var2">

basicly conditions let you do some real basic php, nothing fancy.

Marco van Herwaarden
01-20-2005, 06:55 PM
Thanks for the explanation Zachery