PDA

View Full Version : How to write conditional " $post[postcount] % $vboptions[maxposts] == 1" in php?


ThorstenA
09-10-2007, 12:24 PM
If I write $post[postcount] % $vboptions[maxposts] == 1 in php I get an error because of the %. In a conditional it's working. What should I write instead of this in php?

Dismounted
09-10-2007, 12:40 PM
if ($post['postcount'] % $vbulletin->options['maxposts'] == 1)
{
IF TRUE, DO THIS
}

ThorstenA
09-10-2007, 03:54 PM
I have placed this in to postbit_complete. I get this error on showthread for every postbit.

Warning: Division by zero in /includes/class_postbit.php(296) : eval()'d code on line 29

Paul M
09-10-2007, 05:18 PM
Please show what you have actually done.

ThorstenA
09-10-2007, 05:30 PM
I put this code on postbit_display_complete and get the errors:

if ($post['postcount'] % $vbulletin->options['maxposts'] == 1)
{}

Paul M
09-10-2007, 05:39 PM
I think you will need to use $this->registry->options rather than $vbulletin->options.

ThorstenA
09-10-2007, 05:52 PM
That works great!