MyBB Community Forums

Full Version: Forum Selection Variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
am using iif function to put some conditional check over the template display.
Well problem is the condition works like a charm for
$mybb->user['uid]<=0

But when i use these condition
$mybb->forums['fid']==219
or
$fid==219
or
$forums['fid']==219

All those variables just return 0, for every forum/thread/posts.
Those variables work fine when i put condition in class_parsher. :s

Than nick suggested me to check with
$mybb->input['fid']==219

Well, that checked right for the threads display in forum with fid=219, but failed to work for the posts inside threads of that forum. That may be because am using seo mod as well.

Any suggestion is appreciated as i really need to check that condition for some stuff.
$forum['fid'] would be better. Don't know where exactly you're putting the code but it'll be $forum or $forum_info or something like that, look in the lines above to see what the exact variable is.
Well looking few lines above won't do because am inserting the condition in header template.
Am trying to put a popup window, which activates on all forums and sub-forum, except the forum with fid==219.
And strangely, none of those variables are working n am pulling my hairs off head , thinking why they aren't working.. :s
You can't put stuff like this in templates, PHP isn't enabled in templates, you'd need a plugin.
Yup, thats what i said, am using iif function (placed it in functions.php) for that.. can't remember where i found that hack. it enables to use simple true false conditions in templates.
Only problem is,
This is working fine
<if condition=$mybb->user['uid']<= 0 <then>
Code Goes Here
<else />
</if>
But this fails
<if condition=($mybb->input['fid']== 219||$thread['fid']== 219||$fid== 219||$mybb->forums['fid']==219||$forum['fid']== 219) <then>
do nothing
<else />
Code Goes Here
</if>
or even if i check variables seperately, it fails.

Here is the function i inserted in functions.php
function iif($expression, $returntrue, $returnfalse = '')
{
return ($expression ? $returntrue : $returnfalse);
}