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.
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.
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.
(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...
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.
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...
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.
I'm guessin' this is a variable I'm talking about... (Pulled from ForumHome tepmplate) HTML: {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?