Not Solved If conditions in templates
#1
Not Solved
in inc/functions.php

Find


/**
 * Outputs a page directly to the browser, parsing anything which needs to be parsed.
 *
 * @param string The contents of the page.
 */

add under

// ###################### Start iif #######################
function iif($expression, $returntrue, $returnfalse = '')
{
return ($expression ? $returntrue : $returnfalse);
}
// #############################################


in inc/class_templates.php

find


$template = str_replace("\\'", "'", $db->escape_string($template));

add under

$template= str_replace("<if condition=","\".iif(",$template);
$template= str_replace("<then>",",\"",$template);
$template= str_replace("<else />","\",\"",$template);
$template= str_replace("</if>","\").\"",$template);





code is

<if condition=$mybbuser['uid']== 1 <then>
Other Users <else /> Is User 1 </if>
Reply
#2
Not Solved
Is this for users or usergroups?
Reply
#3
Not Solved
FYI, $mybbuser is deprecated and will not work. It's $mybb->user
Reply
#4
Not Solved
on my board it still works what are you on about

and i am using 1.2.1
Reply
#5
Not Solved
depreciated, doesn't mean removed. It means your not supposed to use it anymore.
Reply
#6
Not Solved
i know that only to show how code works anyway

plus will not work with $mybb->user
Reply
#7
Not Solved
Doesn't work with 1.2.2 for some reason.
CafeParents.com - Parent-to-Parent discussion forums
Reply
#8
Not Solved
Massacre Wrote:plus will not work with $mybb->user

Why wouldn't it work? o.0
[Need Smilies? Get Me Smileys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)