I have a variable called $pagetext that contains this information:
Code:
<if condition="is_member_of($bbuserinfo, 9)">Member of Group</if>More words ...
I want to have that variable evaluated by a template
Code:
eval('$html .= "' . fetch_template('pagetext') . '";');
and eventually output by another template
Code:
eval('print_output("' . fetch_template('shell') . '");');
When I try to do that, the conditional is simply ignored, ie even if the user is not a member of group 9, the "Member of Group" text still appears.
Any ideas on how to do this?
************************************************** ***
Okay, here's a nasty solution I found. First, let me explain the situation better. I have a custom table in the forums db that holds text to be output on a custom webpage. I process that page through vbulletin to use vb's styles, permissions, etc. In my example above, the variable $pagedata, holds the content for the page. It also contains vb conditionals. If I just evaluate the variable in a template, the template was simply ignoring the conditionals.
So .... here is my ugly solution. When the information for that page is updated in my custom table, I create a template for that page.
PHP Code:
$db->query("DELETE FROM `" . TABLE_PREFIX . "template` WHERE `title` LIKE '$pageurl'");
$db->query("INSERT INTO `" . TABLE_PREFIX . "template` (`styleid`,`title`,`template`,`template_un`,`templatetype`,`dateline`,`username`,`version`) VALUES (1, '".$pageurl."','".mysql_real_escape_string(compile_template($pagedata))."','".mysql_real_escape_string($pagedata)."','template',".TIMENOW.",'Brent Layman','3.5.0')");
then I rebuild my templates:
PHP Code:
require_once(DIR . '/includes/adminfunctions.php');
build_all_styles();
Now, when I want to display the page, I first call the template and evaluate the bbcode:
PHP Code:
eval('$pagedata = "' . fetch_template($pageurl) . '";');
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$parsed_text = $parser->do_parse($pagedata, 1, 1, 1, 1, 1, $cachable);
$pagedata = $parsed_text;
and now evaluate into my original template:
PHP Code:
eval('$html .= "' . fetch_template('pagetext') . '";');
There's gotta be a better way!!