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)

Dax IX 11-25-2012 02:20 AM

I'm sorry, I thought it was pretty obvious. It's within the forum title link and the conditional I added is the only one in the statement, but here's my whole code for forumhome_forumbit_level2_nopost

PHP Code:

<li class="forumbit_nopost {vb:raw forum.statusicon} L2" id="cat{vb:raw forum.forumid}">
    <
div class="forumrow table"><div class="foruminfo td">
                    <
img src="{vb:stylevar imgdir_statusicon}/category_forum_{vb:raw forum.statusicon}.png" class="forumicon" id="forum_statusicon_{vb:raw forum.forumid}" alt="" />
        <
div class="forumdata">
<
div class="datacontainer">
            <
h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22,24))"target="_blank"</vb:if>>{vb:raw .title}</a></h2>
            <
vb:if condition="$show['forumdescription']"><class="forumdescription">{vb:raw forum.description}</p></vb:if>
            <
vb:if condition="!$show['collapsable_forums']"><a href="javascript://" class="collapsegadget"></a></vb:if>
            <
vb:if condition="$show['subforums']">
                {
vb:raw forum.subforums}
            </
vb:if>
        </
div>
</
div>
    </
div></div>
    <
vb:if condition="$childforumbits">
        <
ol id="c_cat{vb:raw forum.forumid}" class="childforum">
            {
vb:raw childforumbits}
        </
ol>
    </
vb:if>
</
li

Thanks! :)

--------------- Added 24 Nov 2012 at 23:09 ---------------

The conditional I added was this:

PHP Code:

<vb:if condition="in_array($forum['forumid'], array(22,24))"target="_blank"</vb:if> 


BirdOPrey5 11-25-2012 01:06 PM

Not that it should make a difference but did you try putting spaces outside the conditional?

Code:

"forumtitle" <vb:if condition="in_array($forum['forumid'], array(22,24))"> target="_blank"</vb:if> >{vb:raw .title}</a></h2>

Lynne 11-25-2012 03:37 PM

This worked fine for me:

HTML Code:

<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle" <vb:if condition="in_array($forum['forumid'], array('22','24'))"> target="_blank"</vb:if> >{vb:raw forum.title}</a></h2>

Dax IX 11-25-2012 04:57 PM

Thank you both. :)

I got it to work by posting the same code in forumhome_forumbit_level2_post

For some reason I was thinking it was using forumhome_forumbit_level2_nopost

Thanks again! :)

Nirjonadda 12-08-2012 02:53 PM

How to Usergroups able to view but can not use ?

Code:

<vb:if condition="is_member_of($bbuserinfo, 6,7,9,10,16)">
  code here
  </vb:if>


Ary Braga 12-19-2012 12:59 AM

How do I get these two conditional work properly in a single task. I can not make it work.

Can someone help me?

PHP Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43)">
                       <
vb:if condition="$post['currentactivity']">{vb:raw post.currentactivity}
    </
vb:if>
            </
vb:if> 


BirdOPrey5 12-19-2012 07:41 PM

You just use AND to join two conditions that both must be true.

Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43) AND $post['currentactivity']">
{vb:raw post.currentactivity}
 </vb:if>


AndrewSimm 12-27-2012 11:47 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2391724)
You just use AND to join two conditions that both must be true.

Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43) AND $post['currentactivity']">
{vb:raw post.currentactivity}
 </vb:if>


I tried using this in a CMS widget and it would not work. Any ideas?

BirdOPrey5 12-29-2012 07:51 PM

Do you mean a widget template? Because template conditionals won't work in widget PHP code.

My guess is regardless, $post is a variable only available inside posts (the postbit template) and would not be available in any CMS template, so it would always return FALSE.

AndrewSimm 12-31-2012 12:27 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2393448)
Do you mean a widget template? Because template conditionals won't work in widget PHP code.

My guess is regardless, $post is a variable only available inside posts (the postbit template) and would not be available in any CMS template, so it would always return FALSE.

I see, so there is no way I could hide a block ad that I insert into a widget?


All times are GMT. The time now is 05:23 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.01670 seconds
  • Memory Usage 1,765KB
  • 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
  • (4)bbcode_code_printable
  • (1)bbcode_html_printable
  • (3)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
  • (2)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