Go Back   vBulletin Setup > vBulletinSetup Information > vBulletin Questions


Please Register to get full access to the forums.
Post New Thread  Reply



#21   06-01-2007, 06:32 PM
sinjix_media will become famous soon enough Join Date: Dec 2006 Posts: 14
Re: vBulletin Template Conditionals List


I'm using
Code:
<ul>
    <li <if condition="THIS_SCRIPT != 'index'">id="current"</if>><a href="$vboptions[bburl]">Home</a></li>
    <li <if condition="THIS_SCRIPT != 'index'">id="current"</if>><a href="$vboptions[bburl]">Forums</a></li>
    <li <if condition="THIS_SCRIPT != 'ppindex'">id="current"</if>><a href="$vboptions[bburl]">Gallery</a></li>
    <li <if condition="THIS_SCRIPT != 'usercp'">id="current"</if>><a href="$vboptions[bburl]/usercp">Profile</a></li>
    <li <if condition="THIS_SCRIPT != 'Tags'">id="current"</if>><a href="$vboptions[bburl]/tags/">Tags</a></li>
  </ul>
It's not working.
What am I doing wrong?
Quote   |  



#22   06-01-2007, 07:06 PM
Send a message via AIM to Brandon Send a message via MSN to Brandon Send a message via Yahoo to Brandon Brandon is a glorious beacon of lightBrandon is a glorious beacon of lightBrandon is a glorious beacon of lightBrandon is a glorious beacon of light Join Date: Jul 2006 Posts: 10,508 Location: Topeka, KS
Re: vBulletin Template Conditionals List


I see 2 ">>" and you want all links to point to the forum ?
--------------------
Brandon Sheley / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Be sure to check out our latest Contest for a Custom Style.


Add our Facebook Blog, Group and LinkedIn group.. Thanks
Stay up to date by installing our Tool Bar
Quote   |  



#23   07-22-2007, 04:07 AM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Posts: 1,602 Location: Anaheim, CA
Test


test
test
test
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Be sure to check out our latest Contest for a Custom Style.
Quote   |  



#24   08-30-2007, 04:30 PM
Michael Biddle is just really niceMichael Biddle is just really nice Join Date: Aug 2006 Posts: 1,602 Location: Anaheim, CA
vBulletin Template Condition List


vBulletin is an excellent product that gives the admin amazing control over their vBulletin Forum directly from the templates themselves. You can use PHP if conditionals directly within the template system thanks to vBulletin.

There are too many possible ways to use conditionals to be able to list every single way but we can tackle some of the most popular ones.

I will first explain what the conditional is doing and then list the conditional below it.

If Viewer is a Member
--------------------------------------------------
If you want to show a link only to registered members you would use this conditional.
HTML Code:
<if condition="$show['member']"></if>
If Viewer is in the Following Usergroups Array. Enter the Usergroup Number(s) Seperated by a Comma
--------------------------------------------------
If you want to show an advertisement to viewers that are unregistered, registered members and awaiting email confirmation you would use the usergroup ids 1,2,3 within the array.
HTML Code:
<if condition="is_member_of($vbulletin->userinfo, 1, 2, 3)"></if>
If This Script Is or Is Not XXX
--------------------------------------------------
If this script is index (as used in the example below) then it will show the code within the conditional. You can use it to show a piece of code only on Forumhome if you have to put it in a template that is global such as the header. To find out what the script is per page open up the php file that loads the page like for instance showthread.php and look for
PHP Code:
define('THIS_SCRIPT''showthread'); 
and the showthread part is what you would use.
HTML Code:
<if condition="THIS_SCRIPT == 'index'"></if>
and here you can show information on every page but the index page by using this conditional
HTML Code:
<if condition="THIS_SCRIPT != 'index'"></if>
If this user equals or does not equal xxx
--------------------------------------------------
What this conditional will do is only show certain information if the person viewing the page has the same userid as defined within the conditional. So if you put userid 667 inside the conditional below and put a link inside the conditional tags only the user that has the userid 667 will see that link.
HTML Code:
<if condition="$bbuserinfo['userid'] == 667"></if>
and it works the opposite way as well if you do not want information to show for 667 but you want it to show for everyone else you would use
HTML Code:
<if condition="$bbuserinfo['userid'] != 667"></if>
Display Information To Guests Only
--------------------------------------------------
The following conditional will display information only to guests and no one else. This is helpful in displaying a welcome message that you only wish for guests to see.
HTML Code:
<if condition="$show['guest']"></if>
Display Information On a Per Forum Basis
--------------------------------------------------
This conditional allows you to display information on a per forum basis. This can be helpful if you wish to display different advertisements depending on what forum that the user is in. You would simply replace X with the forum id that you wish the information to appear in.
HTML Code:
<if condition="$forum[forumid] == X"></if>
and on the other hand you can use the ! to do the opposite and display the information in every forum but the id you list
HTML Code:
<if condition="$forum[forumid] != X"></if>
or if you have multiple forums you wish to include something with you can use an array such as this
HTML Code:
<if condition="in_array($forum['forumid'], array(1,2,3,6))"></if>
If Usergroup Is or Is Not X
--------------------------------------------------
If the user is a member of the x usergroup then show the code
HTML Code:
<if condition="$post['usergroupid'] == 6"></if>
and then you can use the ! to tell it to not show it to the x usergroup but show it to everyone else.
HTML Code:
<if condition="$post['usergroupid'] != 6"></if>
If Users Birthday is Less Than or Greater Than XXXX-XX-XX Do Something
--------------------------------------------------
Just to show the power of vBulletin here is a cool conditional that will show information based on the birthday of the user. The one below will show "Too Young" if they were born after 01-01-1980.
HTML Code:
<if condition="$bbuserinfo['birthday_search'] > '1980-01-01'">Too Young</if>
and this one will show you "Too Young" if the user was born before 01-01-1980
HTML Code:
<if condition="$bbuserinfo['birthday_search'] < '1980-01-01'">Too Young</if>
If Thread is or is not in X Forum Execute Code
--------------------------------------------------
For instance if you want a piece of code to appear within thread in a particular forum you can do so with this conditional.
HTML Code:
<if condition="$thread['forumid'] == X"></if>
If you want to show the piece of code on every new reply on every thread but 1 forum you can use this which says if thread is in forum x do not show the code but show it for all the other threads out side of forum x.
HTML Code:
<if condition="$thread['forumid'] != X"></if>
and of course you can define multiple forum ids with the array
HTML Code:
<if conditional="in_array($thread['forumid'], array(1,2,3,6))"></if>
Is user moderator of any forum?
--------------------------------------------------
If the user is a moderator execute code.
HTML Code:
<if condition="can_moderate()"></if>
Is user moderator of current forum?
--------------------------------------------------
If the user is a moderator of the current forum execute code
HTML Code:
<if condition="can_moderate($forum['forumid'])"></if>
Is user moderator of x Forum?
--------------------------------------------------
If the user is a moderator of x forum execute code.
HTML Code:
<if condition="can_moderate($forum['x'])"></if>
Note: can_moderate() may add queries to your page.

Is user the thread starter?
--------------------------------------------------
Is the user the thread creator? If so execute code.
HTML Code:
<if condition="$threadinfo['postuserid'] == $bbuserinfo['userid']"></if>
Is user the thread starter?
--------------------------------------------------
If the thread is closed execute code.
HTML Code:
<if condition="!$show['closethread']"></if>
Place Information After First Post
--------------------------------------------------
Useful for adding a advertisement or other information after the first post on every page.
HTML Code:
<if condition="!$GLOBALS['FIRSTPOSTID']"></if>
Place Information After x Post On Every Page
--------------------------------------------------
This will add your code directly after the post number you define on each page. If you put 2 in place of x the code will appear on every page after the second post.
HTML Code:
<if condition="$post['postcount'] % $vboptions['maxposts'] == x"></if>
Using If Else in Templates
--------------------------------------------------
You can also use If Else conditionals within your templates. The below shows you how to correctly do this.
HTML Code:
<if condition="$show['guest']">
    Show Guest This Message
<else />
    Show Everyone but guests this message
</if>
Contributors:
- Chroder
- SirAdrian

Other Useful Sources:
- vBulletin Manual - Template Conditionals
- vBulletin Community Forum - View Single Post - How to do 3 if conditionials?
- vBulletin Setup - Thanks
--------------------
Do NOT PM me for Support!
Michael Biddle / vBulletin Setup Staff
Check out our Newsletter for the latest vB and SEO news.
Are you looking for vBulletin work to be done on your forums ?
Would you like to Help Support vBulletin Setup.
Be sure to check out our latest Contest for a Custom Style.
Quote   |  



#25   08-30-2007, 08:02 PM
Send a message via AIM to Brandon Send a message via MSN to Brandon Send a message via Yahoo to Brandon Brandon is a glorious beacon of lightBrandon is a glorious beacon of lightBrandon is a glorious beacon of lightBrandon is a glorious beacon of light Join Date: Jul 2006 Posts: 10,508 Location: Topeka, KS
Re: vBulletin Template Condition List


I don't know how many times I've came to this list to figure out how to hide something

Thanks for posting it Mike
Quote   |  



#26   08-31-2007, 11:58 AM
Send a message via MSN to Norman Norman will become famous soon enough Join Date: Feb 2007 Posts: 49 Location: [Italy]
Re: vBulletin Template Condition List


Thanks!
Quote   |  



#27   10-30-2007, 02:52 AM
StupiDeity will become famous soon enough Join Date: Oct 2007 Posts: 3
Re: vBulletin Template Conditionals List


Hi

I am almost a n00b with vB. I've been trying to find the conditional for the user join date but have been unsuccessful till now.

Anybody know how I can get to that piece of user data?

Cheers!
Quote   |  



#28   10-30-2007, 05:18 AM
Ross has a spectacular aura about Join Date: May 2007 Posts: 71
Re: vBulletin Template Conditionals List


$vbphrase[join_date]: <strong>$userinfo[datejoined]</strong>

That is what I am using

Hope this helps,

Ross
Quote   |  



#29   10-30-2007, 07:31 AM
StupiDeity will become famous soon enough Join Date: Oct 2007 Posts: 3
Re: vBulletin Template Conditionals List


Hey thanx dude!

I will try it out tonight.

May the forks be with you

Cheers!
Quote   |  



#30   12-05-2007, 03:39 AM
Send a message via MSN to Norman Norman will become famous soon enough Join Date: Feb 2007 Posts: 49 Location: [Italy]
Re: vBulletin Template Conditionals List


Nice list! Thank you.
Quote   |  
Post New Thread  Reply
vBulletin Setup > vBulletinSetup Information > vBulletin Questions


Thread Tools
Display Modes

 
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

LinkBacks (?)
LinkBack to this Thread: http://forum.vbulletinsetup.com/f18/vbulletin-template-conditionals-list-2185.html
Posted By For Type Date
Lista Condizionali dei Template vBulletin - vB-Italy.org This thread Refback 08-08-2008 08:41 AM
Only show for X usergroup - vBulletin.org Forum This thread Refback 09-23-2007 01:47 PM
ads on forum pages - vBulletin Modifications This thread Refback 09-08-2007 03:02 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
vBulletin Variables List Brandon vBulletin Questions 6 01-13-2008 07:34 AM
P2P Directory and Top-List AjEe vBulletin SEO Tips and SEO Questions 0 04-06-2007 12:33 AM
Members List joh vBulletin Questions 2 03-30-2007 05:03 PM
Members List dprundle vBulletin Questions 4 09-12-2006 01:09 PM


All times are GMT -6. The time now is 02:32 PM.

vBulletin Setup, vBulletin Setup Forums, vBulletin Services, vBulletin Blogs, vBulletin SEO, vBulletin Questions, vBulletin Skins, Styles, Templates
vBulletin Hacks / Modifications, vBulletin Monetization, Blogs, vBulletin Link Directory,Quality Link Directory