AdminAddict

Join Us Members List Today's Posts
Go Back   AdminAddict > Forum and Community Development > Community/Forum Software > vBulletin

Discuss vBulletin 4 Template Conditionals List in vBulletin at AdminAddict
From the looks of it yeah it shouldn't be to hard to adjust. But you gotta admit it does remind ...

Welcome to the AdminAddict.

Hello and welcome to AdminAddict! The one-stop resource for forum and community administrators.

We offer a variety of content and resources, but in order to have access to all of our free tips and tools, you need to register a FREE account.

Registration is free, quick and easy.



(Register to remove this advertisement)
Reply
 
Share Thread Tools Search this Thread
Old September 14th, 2009, 09:23 PM   #16
Webmist's Avatar
Join Date: Jan 2008


Default

From the looks of it yeah it shouldn't be to hard to adjust. But you gotta admit it does remind look like one. I like my smarty templates so these type of conditionals wheree....different to get used to.

I'm actually quite comfortable with the ones for vB.

Still hope the make a list though.
June -- Luna Procer
_____________________________________
** giving hugs to the new members **
Vos planto mihi sentio bonus.
Webmist is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old September 14th, 2009, 11:54 PM   #17
Default

It would be almost impossible list all conditionals available for vBulletin. Any variable available to templates can be used in a conditional and than in any combination allowed for conditional constructs in PHP. Just taking the 458 settings/options and the 60 odd fields in the user table gives you 27480 potential conditionals using the && operator alone. Now not all would be viable or worthwhile but they are possible. That doesn't account for combinations where you can use ==. !=. >=, <=, || or compound conditionals. It also doesn't account for usergroups, permissions, forum information, custom profile fields and about 300 other variables that are available on every page.

Next you have to account for scope. For instance the userinfo array is not available in the postbit. You have to use the postinfo array.

Then you would have to account for conditionals that are available in specific templates. Especially since variables have to be registered with templates before they are available in vBulletin. So you won't necessarily be able to use a conditional you saw in the footer inside the header template.

Needless to say any sort of comprehensive list will be larger than the current vBulletin manual which is over 500 pages. It would take hundreds of hours to produce. The benefit just isn't there. It is much easier to answer threads that ask what conditional to use and a vBulletin staff member posts it for them.
vBCodex - Get help building your vBulletin community.
Get Gravatar support for your vBulletin community.
-- Please do not contact me via PM for vBulletin Support.
Wayne Luke is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

1 out of 1 members found this post helpful.
Old September 15th, 2009, 03:27 AM   #18
Zealot
Posts: 1,730
Join Date: May 2009

Experience: Advanced
Forums Admin/Mod: 2
Software: vBulletin

Michael is a glorious beacon of lightMichael is a glorious beacon of lightMichael is a glorious beacon of lightMichael is a glorious beacon of lightMichael is a glorious beacon of light
Default

Quote:
Originally Posted by Wayne Luke View Post
It would be almost impossible list all conditionals available for vBulletin. Any variable available to templates can be used in a conditional and than in any combination allowed for conditional constructs in PHP. Just taking the 458 settings/options and the 60 odd fields in the user table gives you 27480 potential conditionals using the && operator alone. Now not all would be viable or worthwhile but they are possible. That doesn't account for combinations where you can use ==. !=. >=, <=, || or compound conditionals. It also doesn't account for usergroups, permissions, forum information, custom profile fields and about 300 other variables that are available on every page.

Next you have to account for scope. For instance the userinfo array is not available in the postbit. You have to use the postinfo array.

Then you would have to account for conditionals that are available in specific templates. Especially since variables have to be registered with templates before they are available in vBulletin. So you won't necessarily be able to use a conditional you saw in the footer inside the header template.

Needless to say any sort of comprehensive list will be larger than the current vBulletin manual which is over 500 pages. It would take hundreds of hours to produce. The benefit just isn't there. It is much easier to answer threads that ask what conditional to use and a vBulletin staff member posts it for them.
Of course a good list of the most commonly used template conditionals is handy, I know I have them bookmarked for when I need to use one of them somewhere. The more advanced ones I tend to ask for on forums.
Message Boards Directory - Free Directory for forums with over 10,000 posts.

Teen Forum
Michael is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old September 15th, 2009, 05:21 AM   #19
Adept
Peacelily's Avatar
Posts: 241
Join Date: Jul 2009

Experience: Intermediate
Forums Admin/Mod: 2
Software: vBulletin 3.8.x

Peacelily will become famous soon enough
Default

Quote:
The most important part though is that is modular and expandable.



Thanks for posting these Nick and to Wayne for the codex. I am always just so dang happy that I have vBulletin that if you told me I had to use these conditionals while wearing purple pajamas with koala bears on them and singing Yankee Doodle Dandy on BlogTV in front of 50,000 people, I'd still be happy as long as I never have to try to do a hack in phpBB ever again as long as I live.
Peacelily is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old October 10th, 2009, 11:50 PM   #20
ThinkBigTopeka.com
Brandon Sheley's Avatar


Experience: Master

Default Re: vBulletin 4 Template Conditionals List

Great thread, thanks for the info Nick and Wayne
I've been offering Web Services since 2006, here are some past vBulletin Clients
Some of our popular forums: Entertainment | General Discussions | News Nebula
Create your own blog on a 10 year old domain! -> AlienSoup
Brandon Sheley is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old December 27th, 2009, 08:48 PM   #21
Addict
Posts: 70
Join Date: Dec 2009

Software: MyBB

combus is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

Thanks for this list Nick, but how do I go about adding the user's avatar in the header? I tried some things, but with no luck.

Thanks.
combus is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old January 12th, 2010, 12:07 PM   #22
Newcomer
Posts: 9
Join Date: Jun 2009
Location: Maryland

Experience: Advanced
Forums Admin/Mod: 1
Software: vBulletin

George is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

Here is my list I made for vBulletin.org

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:
Code:
<vb:if condition="$show['member']">Show this to members only</vb:if>
Show only guest:
Code:
<vb:if condition="$show['guest']">Show this to guest only</vb:if>
Show specific user groups :
Code:
<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">Show this to user group 1, 2, and 3</vb:if>
Show one member:
Code:
<vb:if condition="$bbuserinfo['userid'] == 318713">Show this only to the member with the user id of 318713</vb:if>
Show every one but one member:
Code:
<vb:if condition="$bbuserinfo['userid'] != 318713">Show this to every one but the member with the user id of 318713</vb:if>
Show only moderators of any forum:
Code:
<vb:if condition="can_moderate()">Show this to all moderators</vb:if>
Show Moderator of one forum: Remember to change x
Code:
<vb:if condition="can_moderate($forum['x])">Show this if moderator is moderator of the forum with the id of x</vb:if>
Show Moderator of current forum:
Code:
<vb:if condition="can_moderate($forum['forumid'])">Show this to the moderator of the current forum</vb:if>
Show in one forum: Remember to change x
Code:
<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>
Show is every forum but one: Remember to change x
Code:
<vb:if condition="$forum[forumid] != x">Show this if forum id is not x</vb:if>
Show in several forums:
Code:
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>
Show in only one file: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you want it to show in.
Code:
<vb:if condition="THIS_SCRIPT == 'calendar'">Show this only on calendar.php</vb:if>
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.
Code:
<vb:if condition="THIS_SCRIPT != 'calendar'">Show this only on calendar.php</vb:if>
If $customvar is set:
Code:
<vb:if condition="$customvar">Show this if $customvar is set</vb:if>
If $customvar equals:
Code:
<vb:if condition="$customvar == blah">Show this if $customvar equals blah</vb:if>
If $customvar does not equal:
Code:
<vb:if condition="$customvar != blah">Show this if $customvar does not equal blah</vb:if>
vBulletin else statement:
Code:
<vb:if condition="$show['guest']">
Show this to only guest.
<vb:else />
Show this to all registered users
</vb:if>
vBulletin else if statement:
Code:
<vb:if condition="$show['guest']">
Show this to only guest.

<vb:elseif condition="is_member_of($bbuserinfo, 5,6)" />
Show this to user group 5 and 6 which is  mods and admins

<vb:else />
Show this to all registered users

</vb:if>
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.

You may have to register the variable depending where you use it.
George is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

1 out of 1 members found this post helpful.
Old January 12th, 2010, 01:42 PM   #23
Champion
Ryan Ashbrook's Avatar
Posts: 298
Join Date: Jun 2009
Location: Cincinnati, Ohio

Experience: Master
Forums Admin/Mod: 4
Software: vBulletin 3.8.x, vBulletin 4.0.x, ImperialBB 1.0.x

Ryan Ashbrook is a glorious beacon of lightRyan Ashbrook is a glorious beacon of lightRyan Ashbrook is a glorious beacon of lightRyan Ashbrook is a glorious beacon of lightRyan Ashbrook is a glorious beacon of light
Default Re: vBulletin 4 Template Conditionals List

Question.

Do variables have to be registered by the template engine in order to be used within a conditional, or do they work similar to vB3 (any set variable can be used, regardless of registration in the template engine)?

I'm preparing to start coding for vBulletin 4, and I'd really like to know this ahead of time.
Regards,
Ryan Ashbrook
Support Team Coordinator; Developer (ImperialBB 1.0.0 Alpha 1 is live!)
www.ryanashbrook.com
Ryan Ashbrook is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old January 12th, 2010, 07:33 PM   #24
Newcomer
Posts: 9
Join Date: Jun 2009
Location: Maryland

Experience: Advanced
Forums Admin/Mod: 1
Software: vBulletin

George is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

Quote:
Originally Posted by Ryan Ashbrook View Post
Question.

Do variables have to be registered by the template engine in order to be used within a conditional, or do they work similar to vB3 (any set variable can be used, regardless of registration in the template engine)?

I'm preparing to start coding for vBulletin 4, and I'd really like to know this ahead of time.
depending where you use the variable custom variables have to be registered. If the variable is already registered in that template then you do not have to register it. Like in postbit template the variable $post is already registered.
George is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old February 21st, 2010, 03:28 PM   #25
Newcomer
Posts: 24
Join Date: Feb 2010

Software: vbulletin 4.0 publishing suite

BlaqHQ is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

wow excel formula used in vb wow
BlaqHQ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old April 13th, 2010, 10:03 PM   #26
Novice
Mopar1973Man's Avatar
Posts: 45
Join Date: Apr 2010
Location: New Meadows, Idaho

Experience: Intermediate
Forums Admin/Mod: 2
Software: Vbulletin 4.0.2

Mopar1973Man is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

Quote:
Originally Posted by Wayne Luke View Post
It would be almost impossible list all conditionals available for vBulletin. Any variable available to templates can be used in a conditional and than in any combination allowed for conditional constructs in PHP.

Huh you said what??? Break it down again...

Just taking the 458 settings/options and the 60 odd fields in the user table gives you 27480 potential conditionals using the && operator alone.
Now not all would be viable or worthwhile but they are possible. That doesn't account for combinations where you can use ==. !=. >=, <=, || or compound conditionals.

Still lost...

It also doesn't account for usergroups, permissions, forum information, custom profile fields and about 300 other variables that are available on every page.

Now we are getting close... Forum information and user account information is a start...

Next you have to account for scope. For instance the userinfo array is not available in the postbit. You have to use the postinfo array.

Ok... Lost me again...

Then you would have to account for conditionals that are available in specific templates. Especially since variables have to be registered with templates before they are available in vBulletin. So you won't necessarily be able to use a conditional you saw in the footer inside the header template.

Needless to say any sort of comprehensive list will be larger than the current vBulletin manual which is over 500 pages. It would take hundreds of hours to produce. The benefit just isn't there. It is much easier to answer threads that ask what conditional to use and a vBulletin staff member posts it for them.
(Comments in blue)

Whoa... hold the horse a sec...

I don't need a complete list that big... But common and basic variable that are already use in most of the templates. Username, post count, etc. Then tell me where and where not they can be used...
Mopar1973Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old April 14th, 2010, 12:23 PM   #27
Webmist's Avatar
Join Date: Jan 2008


Default Re: vBulletin 4 Template Conditionals List

Okay I'lll give it a shot. I know my syntax is off, especially with 4.0. But for laymans terms. The templates take conditional variables which in effect are codes. So say you want the bring over a profile field. Depending on where you want to show it versus what info you want to display will determine what the variable is.

Say you just want a profile field to show in each post.
<vb:if condition = $post[fieldx]>Display field x</vb:if>

But say you want it to show next to their name on the forumdisplay page.
<vb:if condition = $bbuserinfo['fieldx']>Display field x</vb:if>

See where the variable differs?

Now to really boggle the mind. You can add extra conditionals.
<vb:if condition=$bbuserinfo['fieldx'] == 'true'>Display field x if true</vb:if>

Which is where that long list is going. Each script and some templates have different sets of variables to use. That's what this thread is for is to list some of the common ones.

I think it would be great if we can continue this thread for vb4 and get a list going.
June -- Luna Procer
_____________________________________
** giving hugs to the new members **
Vos planto mihi sentio bonus.
Webmist is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old April 14th, 2010, 06:53 PM   #28
Novice
Mopar1973Man's Avatar
Posts: 45
Join Date: Apr 2010
Location: New Meadows, Idaho

Experience: Intermediate
Forums Admin/Mod: 2
Software: Vbulletin 4.0.2

Mopar1973Man is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

Nevermind... I'm just going to give up... (sigh)

I want to re-design the template and layout but I don't have enough information about the variables... There is no information or help on how to work with the templates properly. Of course if you ask anyone that build themes/skins they will ak you to open your wallet... My site is operated on donated funds so I'm extremely limited...

I like to sit down with a screen print and label out the current variables lets say on the main forum page. Then take a new piece of paper and re-draw the forum page the way I would like it. But I want to add or change information displayed... Let say I like to draw out a blue print first before I go hacking up a page. Then everything just goes smoothly.

Like having a Service Manual for your Dodge pickup. Then you know how tight to make all the bolts for your particular part or project. I'm not asking for every single variable but the common one used in the templates (that display information) would be prefect...

I'm getting tried of the software really quick... I've spent my entire winter in front of a computer gained nearly 30 pounds and all I got to show for it is a re-colorized forum...
Mopar1973Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old April 14th, 2010, 08:43 PM   #29
Webmist's Avatar
Join Date: Jan 2008


Default Re: vBulletin 4 Template Conditionals List

Sorry to hear that. I do know what you mean. I don't know how many times such an animal has been asked for. You would think someone would have published a cheat sheet by now.

To point out though most that skin forums don't ask you to open your wallet. They just won't do the work for you. Most of us learned by doing searches at the various vb sites, playing around with variables and when all else fails asking. With vb the best way is to do a rough sketch and then define the content.

I'm more than willing and probably others here too will help. If you have that blueprint ready and know what information you are seeking to put somewhere.
June -- Luna Procer
_____________________________________
** giving hugs to the new members **
Vos planto mihi sentio bonus.
Webmist is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Old April 14th, 2010, 09:08 PM   #30
Novice
Mopar1973Man's Avatar
Posts: 45
Join Date: Apr 2010
Location: New Meadows, Idaho

Experience: Intermediate
Forums Admin/Mod: 2
Software: Vbulletin 4.0.2

Mopar1973Man is on a distinguished road
Default Re: vBulletin 4 Template Conditionals List

I'm guessin' this is a variable I'm talking about... (Pulled from ForumHome tepmplate)

HTML Code:
{vb:raw totalonline}
I'm assuming this displays total online member (for this period of time)...

Now what variables can I use lets say on the ForumHome? There is a ton of them in the template but I got no idea what some of them do or don't do? So how can I draw up a blue print when I don't know what I'm allowed to use or not allowed to use here???

Like saying I want to build a six story building in McCall, ID but the McCall building code says "5 Stories max hieght". I can still build the building but knowing I've got a limitation...

So what variables are there and what can I use? I'm trying to gather up my information now so I can draw a blueprint design and see if it can be done...

Then knowing the variables is like knowing if I got 2x4x8 or 2x4x10, etc... I know if it get to nail it together or screw it together... What do I got to work with?


Last edited by Mopar1973Man; April 14th, 2010 at 09:11 PM..
Mopar1973Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTwitterShare on Facebook
Reply With Quote

Reply

Tags
conditionals, List, template, vBulletin

AdminAddict > Forum and Community Development > Community/Forum Software > vBulletin > vBulletin 4 Template Conditionals List


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:59 PM.
Powered by vBulletin®, ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright ©2008-2010 AdminAddict, All Rights Reserved


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53