vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom HTML not accepting vb conditions (https://vborg.vbsupport.ru/showthread.php?t=328246)

Dr.CustUmz 09-25-2020 07:23 PM

Custom HTML not accepting vb conditions
 
1 Attachment(s)
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:
Code:

<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
Code:

$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD (bannercode TEXT NOT NULL DEFAULT '')");
Template:
Code:

<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:
Code:

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

Code:

<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

Quote:

Originally Posted by Seven Skins (Post 2604053)
May be this

Code:

<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
It allows you to add html per forum and still works with 3.8

Dr.CustUmz 09-29-2020 09:40 PM

1 Attachment(s)
Quote:

Originally Posted by blind-eddie (Post 2604093)
I have been using Add banner above forum
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
Code:

<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.


All times are GMT. The time now is 02:09 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01087 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete