vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

GameOverViper 05-04-2013 07:29 PM

Quote:

Originally Posted by Lynne (Post 2419945)
It would actually be like this:

PHP Code:

 <vb:if condition="!is_member_of($bbuserinfo, 1)">ad code here</vb:if> 


Thanks a lot Lynne! It worked. I appreciate it! :)

Kirk93 06-23-2013 04:45 PM

This is driving me up the f*cking wall. Can someone help me?

I've created a custom forum block template that I want to use for advertisements only. Basically, I want the advertisements to display to everyone EXCEPT for our subscribers. I've tried variations of code but either the advertisements appear to all usergroups or to none.

Code:

<vb if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,8,15,16,17)">
<li>
        <div class="block smaller">
                <div class="blocksubhead">
                        <a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
                        <span class="blocktitle">{vb:raw blockinfo.title}</span>
                </div>
                <div class="widget_content blockbody floatcontainer">
                <div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
                        {vb:raw content}
                </div>
                </div>
        </div>
        <div class="underblock"></div>
</li>
</vb:if>

Can someone tell me EXACTLY how to do this? The usergroup ID for subscribed members is "11". :)

I can't seem to add an ELSE statement of any kind because all I get is an "Invalid Nesting" error.

kh99 06-23-2013 05:09 PM

I think the problem might be caching. Try setting "Cache Time" to 0 and see if that works.

You should be able to use <vb:else /> to have an else section (but it needs the closing slash).

ETA: also, your first line is missing a colon. It should start with <vb:if condition=....

Kirk93 06-23-2013 07:26 PM

What should I add after <vb:else />? :)

kh99 06-23-2013 08:34 PM

Quote:

Originally Posted by Kirk93 (Post 2430032)
What should I add after <vb:else />? :)

Well, I was just answering where you said you couldn't get any "else" to work. But I guess you'd do something like:
Code:

<vb:if condition="is_member_of($bbuserinfo, 1, 2, 3)">
Stuff to show to groups 1, 2, 3
<vb:else />
Stuff to show everyone else
</vb:if>

so if there's nothing that you want the other groups to see, you don't need an "else".

Do you have it working at all yet?

Kirk93 06-23-2013 08:50 PM

I've got it how I described in the original post, except now with the colon. All groups can see the advert.

I'm trying to get it so that subscribers (11) don't see the advert, or the forum block for that matter.

kh99 06-23-2013 09:02 PM

So how did you create it exactly? Did you choose "Custom HTML/PHP" block? And how did you fill in the rest of the form?

Kirk93 06-24-2013 08:39 AM

I copied the original block_html template and then made a new one named "adblock_html" with the same coding. I then added the conditionals (see above) and adjusted the settings for my Amazon advert block to use the "adblock_html" template.

kh99 06-24-2013 02:22 PM

That sounds good. Did you set the cache time to 0?

As Scanu posted in the other thread, something like this should work and it's a little shorter:

Code:

<vb:if condition="!is_member_of($bbuserinfo, 11)">
<li>
        <div class="block smaller">
                <div class="blocksubhead">
                        <a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
                        <span class="blocktitle">{vb:raw blockinfo.title}</span>
                </div>
                <div class="widget_content blockbody floatcontainer">
                <div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
                        {vb:raw content}
                </div>
                </div>
        </div>
        <div class="underblock"></div>
</li>
</vb:if>


Kirk93 06-24-2013 03:12 PM

What the...

I swear I did that yesterday. xD Ah well, that seems to have done the trick! Thank you very much mate!

Gosh, all this stuff isn't very noob friendly haha.


All times are GMT. The time now is 05:41 PM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01481 seconds
  • Memory Usage 1,744KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete