Dr.CustUmz
09-25-2020, 07:23 PM
I've made a setting in forum manager which adds an extra option to add custom html to each forum.
my problem is when i use if conditions
EXAMPLE:
<if condition="THIS_SCRIPT == 'showthread">showthread</if>
<if condition="THIS_SCRIPT == 'forumdisplay">forumdisplay</if>
they are not functioning and both sections show up regardless. All other HTML works fine, just not if conditions.
I created the row
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (bannercode TEXT NOT NULL DEFAULT '')");
Template:
<if condition="$foruminfo['banner'] AND $foruminfo['bannerlink']">
<center>
<a href="$foruminfo[bannerlink]" target="_blank"><img src="$foruminfo[banner]" alt="$foruminfo[banneralt]" border="0" /></a>
</center>
<br />
<else />
<if condition="$foruminfo['banner']">
<center>
<img src="$foruminfo[banner]" alt="$foruminfo[banneralt]" border="0" />
</center>
<br />
<else />
<if condition="$foruminfo['bannercode']">
<center>
$foruminfo[bannercode]
</center>
<br />
</if>
</if>
</if>
Global start plugin:
if (THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread'){
if (THIS_SCRIPT == 'forumdisplay'){
$search_text = '$navbar';
$vbulletin->templatecache['FORUMDISPLAY'] = str_replace($search_text,
$search_text.fetch_template('add_banner'), $vbulletin->templatecache['FORUMDISPLAY']);
}else{
if ($foruminfo['bannerthread'] == '1'){
$search_text = '$navbar';
$vbulletin->templatecache['SHOWTHREAD'] = str_replace($search_text,
$search_text.fetch_template('add_banner'), $vbulletin->templatecache['SHOWTHREAD']);
}
}
eval('$add_banner = "' . fetch_template('add_banner') . '";');
}
There are of coarse the forum options and all but I think those are irrelevant to the problem, the data is stored in the database as text. It renders the text inside the if condition, just not the condition itself which is what i need.
my problem is when i use if conditions
EXAMPLE:
<if condition="THIS_SCRIPT == 'showthread">showthread</if>
<if condition="THIS_SCRIPT == 'forumdisplay">forumdisplay</if>
they are not functioning and both sections show up regardless. All other HTML works fine, just not if conditions.
I created the row
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (bannercode TEXT NOT NULL DEFAULT '')");
Template:
<if condition="$foruminfo['banner'] AND $foruminfo['bannerlink']">
<center>
<a href="$foruminfo[bannerlink]" target="_blank"><img src="$foruminfo[banner]" alt="$foruminfo[banneralt]" border="0" /></a>
</center>
<br />
<else />
<if condition="$foruminfo['banner']">
<center>
<img src="$foruminfo[banner]" alt="$foruminfo[banneralt]" border="0" />
</center>
<br />
<else />
<if condition="$foruminfo['bannercode']">
<center>
$foruminfo[bannercode]
</center>
<br />
</if>
</if>
</if>
Global start plugin:
if (THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread'){
if (THIS_SCRIPT == 'forumdisplay'){
$search_text = '$navbar';
$vbulletin->templatecache['FORUMDISPLAY'] = str_replace($search_text,
$search_text.fetch_template('add_banner'), $vbulletin->templatecache['FORUMDISPLAY']);
}else{
if ($foruminfo['bannerthread'] == '1'){
$search_text = '$navbar';
$vbulletin->templatecache['SHOWTHREAD'] = str_replace($search_text,
$search_text.fetch_template('add_banner'), $vbulletin->templatecache['SHOWTHREAD']);
}
}
eval('$add_banner = "' . fetch_template('add_banner') . '";');
}
There are of coarse the forum options and all but I think those are irrelevant to the problem, the data is stored in the database as text. It renders the text inside the if condition, just not the condition itself which is what i need.