Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
vB4 Template Conditionals List
BBR-APBT
Join Date: Feb 2009
Posts: 946

Maryland
by BBR-APBT BBR-APBT is offline 29 Dec 2009
Rating: (2 votes - 4.50 average)

I put this together because it seems lots of people are having problems with the new syntax for conditionals.

First off remember you can not use {vb:raw var} in template conditionals.

Show only members:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show only guest:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show specific user groups :

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show one member:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show every one but one member:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show only moderators of any forum:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Show Moderator of one forum: Remember to change x

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show Moderator of current forum:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in one forum: Remember to change x

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show is every forum but one: Remember to change x

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in several forums:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in only one file: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you want it to show in.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in every file but one: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you do not want it to show in.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If $customvar is set:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If $customvar equals:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If $customvar does not equal:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


vBulletin else statement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


vBulletin else if statement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


This is all that I can think of right now off the top of my head.
Please feel free to add any I forgot and I will add them to this list and give you credit.

Last edited by BBR-APBT : 29 Dec 2009 at 17:16. Reason: Added custom variables.
Views: 67597
Reply With Quote
Comments
  #2  
Old 29 Dec 2009, 07:30
nubian nubian is offline
 
Join Date: Nov 2004
Thumbs up

subscribed!
Reply With Quote
  #3  
Old 29 Dec 2009, 14:34
Antyrael Antyrael is offline
 
Join Date: Apr 2002
Thanks for this list!
Reply With Quote
  #4  
Old 30 Dec 2009, 08:26
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Excuse me a question, to the undersigned not work conditions with $forum[forumid] is the variable that changed?

thanks


PS example

<vb:if condition="!in_array($forum[forumid], array(18,19))">

text text

</vb:if>

Last edited by Asterix_ita : 30 Dec 2009 at 16:16. Reason: add example
Reply With Quote
  #5  
Old 31 Dec 2009, 05:31
Hornstar's Avatar
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Real name: Matt
very nice, this has helped me understand all the conditionals much better.
Reply With Quote
  #6  
Old 31 Dec 2009, 10:13
Hasanudin's Avatar
Hasanudin Hasanudin is offline
 
Join Date: Jun 2003
Real name: Young Hero
subscribe too..

nice, thx u
__________________
Salam Hangat Selalu
Reply With Quote
  #7  
Old 31 Dec 2009, 13:10
nymyth nymyth is offline
 
Join Date: Jun 2002
this is so clutch...nice
Reply With Quote
  #8  
Old 31 Dec 2009, 19:37
rbc's Avatar
rbc rbc is offline
 
Join Date: Jul 2007
Real name: Peter
super, thanks & happy new yeahr
__________________
rbc
Reply With Quote
  #9  
Old 01 Jan 2010, 07:38
baghdad4ever baghdad4ever is offline
 
Join Date: May 2007
Real name: husam
thank you very much
Reply With Quote
  #10  
Old 01 Jan 2010, 09:23
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Originally Posted by Asterix_ita View Post
Excuse me a question, to the undersigned not work conditions with $forum[forumid] is the variable that changed?

thanks


PS example

<vb:if condition="!in_array($forum[forumid], array(18,19))">

text text

</vb:if>
$forum[forumid] have to be registered to the template.
There's an other article here.
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #11  
Old 01 Jan 2010, 09:37
Asterix_ita's Avatar
Asterix_ita Asterix_ita is offline
 
Join Date: Aug 2009
Originally Posted by ragtek View Post
$forum[forumid] have to be registered to the template.
There's an other article here.
thanks, I must enter the new logic. Happy New Year
Reply With Quote
  #12  
Old 02 Jan 2010, 11:27
MikeWarner's Avatar
MikeWarner MikeWarner is offline
 
Join Date: Nov 2001
Hi - thanks for this post, however, can you provide conditionals for CMS sections please?
__________________
No signature - please check back later
Reply With Quote
  #13  
Old 02 Jan 2010, 15:19
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Originally Posted by MikeWarner View Post
Hi - thanks for this post, however, can you provide conditionals for CMS sections please?
I don't have the CMS and most of these will work for the CMS.

You may have to preregister the var.
Reply With Quote
  #14  
Old 05 Jan 2010, 18:44
abumohamed abumohamed is offline
 
Join Date: Mar 2005
Real name: ahmed
Thanks
__________________
my sites : krwetatnt flash games english directory
Reply With Quote
  #15  
Old 05 Jan 2010, 23:14
hochun hochun is offline
 
Join Date: Dec 2009
Hello everybody! I have one problem with porting one of my products to VB4.

I have the setting for a product called vfsms_can_stick_by_sms - it's comma separated list of forum-sections where this product is turned on.

In this product I have the following plugin:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And in template SHOWTHREAD I have next conditional:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I have few problems:

1. variable $vfsms_allowed4sticky_forums can be accessed only as a {vb:raw vfsms_allowed4sticky_forums} and I can not put it to the condition
2. variable $forumid is not accessible anymore

Please, somebody, help me!

--------------- Added 05 Jan 2010 at 23:28 ---------------

but everything is ok if I pass variable directly from the showthread.php:



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and in template also replace $forumid on $thread[forumid]

This is absolutely wrong way of doing the thing I need, pls tell me how to do it without changes in showthread.php!

Last edited by hochun : 05 Jan 2010 at 23:28. Reason: Auto-Merged DoublePost
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 07:34.

Layout Options | Width: Wide Color: