PDA

View Full Version : Custom HTML not accepting vb conditions


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.

Seven Skins
09-25-2020, 07:56 PM
May be this

<if condition="THIS_SCRIPT == showthread">showthread</if>
<if condition="THIS_SCRIPT == forumdisplay">forumdisplay</if>

OR

<if condition="THIS_SCRIPT == 'showthread'">showthread</if>
<if condition="THIS_SCRIPT == 'forumdisplay'">forumdisplay</if>

Dr.CustUmz
09-25-2020, 08:05 PM
May be this

<if condition="THIS_SCRIPT == showthread">showthread</if>
<if condition="THIS_SCRIPT == forumdisplay">forumdisplay</if>

OR

<if condition="THIS_SCRIPT == 'showthread'">showthread</if>
<if condition="THIS_SCRIPT == 'forumdisplay'">forumdisplay</if>

its not only the this script condition, no if condition at all is working within this. :(
I think it has something to do with the way the data is used from the DB but Im at a loss right now.

Dr.CustUmz
09-29-2020, 02:39 AM
I did come up with a workaround by creating 2 separate options within the forum manager, one for forumdisplay, and one for showthread, but I really do need some help getting these to both be within one option.

blind-eddie
09-29-2020, 09:09 AM
I have been using Add banner above forum (https://vborg.vbsupport.ru/showthread.php?t=132716&highlight=Add+Banner)
It allows you to add html per forum and still works with 3.8

Dr.CustUmz
09-29-2020, 09:40 PM
I have been using Add banner above forum (https://vborg.vbsupport.ru/showthread.php?t=132716&highlight=Add+Banner)
It allows you to add html per forum and still works with 3.8

that's actually the hack I have modified. But I cant get <if condition="THIS_SCRIPT == showthread">showthread</if> To work within it. Or any if conditions at all

Glad to see your still around eddie =)

PinkMilk
09-30-2020, 02:21 PM
Your trying to add the if conditions as the custom html but it's basicly seen as php and will not render meaning all it spits out is the html/text.

My suggestion would be to maybe just double up i.e create 2 sets of options 1 for showthread and 1 for forumdisplay rather then if else as it currently is, then have an enable/disable option for each.