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)

Gripi 06-06-2012 07:53 AM

hi..

i try to put this in the forumdisplay template, but no luck, anyone could help:

<vb:if condition="!in_array($forum['forumid'], array(1, 2))">not show to forumid 1 and 2</vb:if>

still showing to all forum ID, and i read from the 1st page this thread, lots of people got the same problem with me.

BirdOPrey5 06-06-2012 09:26 AM

Try using-

Code:

<vb:if condition="!in_array($foruminfo['forumid'], array(1, 2))">not show to forumid 1 and 2</vb:if>
Also, I've never seen a VB forum with a usable forumid 1. Usually 2 is the first usable forumid. 1 is the main category which doesn't work in such a conditional.

Gripi 06-06-2012 02:09 PM

ok..

one more thing..

how to make condition "show only to member that already had >= 50 post count" ?

<vb:if condition="$post['postcount'] >= 50"> now show to under 50 postcount</vb:if>

the command above wont work.

thanks

fly 06-06-2012 02:24 PM

Quote:

Originally Posted by Gripi (Post 2337134)
ok..

one more thing..

how to make condition "show only to member that already had >= 50 post count" ?

<vb:if condition="$post['postcount'] >= 50"> now show to under 50 postcount</vb:if>

the command above wont work.


thanks

Try:

<vb:if condition="$userinfo['postcount'] >= 50"> now show to under 50 postcount</vb:if>

Gripi 06-06-2012 02:29 PM

Quote:

Originally Posted by fly (Post 2337140)
Try:

<vb:if condition="$userinfo['postcount'] >= 50"> now show to under 50 postcount</vb:if>

hi..

not working too.. the command not show to all member.. not just member with under 50 post count

BirdOPrey5 06-06-2012 03:07 PM

The variable would be $bbuserinfo['posts'], not $userinfo['postcount'] in forumdisplay.

Gripi 06-06-2012 03:56 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2337159)
The variable would be $bbuserinfo['postcount'], not $userinfo['postcount'] in forumdisplay.

i want to put the command inside the "postbit_legacy", and the above command wont work too.

--------------- Added [DATE]1339003487[/DATE] at [TIME]1339003487[/TIME] ---------------

Quote:

Originally Posted by BirdOPrey5 (Post 2337055)
Try using-

Code:

<vb:if condition="!in_array($foruminfo['forumid'], array(1, 2))">not show to forumid 1 and 2</vb:if>
Also, I've never seen a VB forum with a usable forumid 1. Usually 2 is the first usable forumid. 1 is the main category which doesn't work in such a conditional.

just try this, not working in "ad_global_below_navbar" template too.

BirdOPrey5 06-06-2012 04:48 PM

Sorry the post count for a user is $bbuserinfo['posts']

for ad_global_below_navbar try $GLOBALS['forumid']

Gripi 06-07-2012 03:40 AM

thanks, globals works :)

stuartn 06-07-2012 03:03 PM

Code:

<vb:if condition="in_array($foruminfo[forumid], array(166,113,110,109,108))"></vb:if>
Works fine in mine...

--------------- Added [DATE]1339085022[/DATE] at [TIME]1339085022[/TIME] ---------------

Obviously the ! addition to the in_array has the reversed effect

fanhockeycoach 06-08-2012 09:19 PM

HELP

I am trying this code but its not working.

<vb:if condition="$forum=59">{vb:raw show.vbshout_instance3}</vb:if>

I want this shout box to show only in forum 59 but it shows up in every forum.

What am i doing wrong? Does this go in FORUMDISPLAY?

fly 06-09-2012 12:51 PM

Quote:

Originally Posted by fanhockeycoach (Post 2337935)
HELP

I am trying this code but its not working.

<vb:if condition="$forum=59">{vb:raw show.vbshout_instance3}</vb:if>

I want this shout box to show only in forum 59 but it shows up in every forum.

What am i doing wrong? Does this go in FORUMDISPLAY?

Your syntax is incorrect. Please reread the first post.

fanhockeycoach 06-09-2012 06:01 PM

i did reread and still not sure why I can't have this show up only in a certain forum

kh99 06-09-2012 07:52 PM

I know you need a double '=', like:

Code:

<vb:if condition="$forum==59">{vb:raw show.vbshout_instance3}</vb:if>

but I'm not sure if $forum is what you should be using or not.

fanhockeycoach 06-09-2012 09:06 PM

Quote:

Originally Posted by kh99 (Post 2338233)
I know you need a double '=', like:

Code:

<vb:if condition="$forum==59">{vb:raw show.vbshout_instance3}</vb:if>

but I'm not sure if $forum is what you should be using or not.

YOU ROCK

it was forum info

Ok now I think I got it to work

<vb:if condition="$foruminfo['forumid']==X">{vb:raw show.vbshout_instanceY}</vb:if>

X - forum ID #
Y - instance #

ddshosting 07-02-2012 07:46 PM

Has anyone used a template conditional statement in the header for the URL or a regexpression of using the URL? I need to spit out differnent elements of the header depending on what section visitors are viewing.

Thanks.

BirdOPrey5 07-02-2012 10:46 PM

I don't see how you can use a regex in a template conditional, there are no regex functions allowed in templates...

The very short list of allowed functions is here:
https://www.vbulletin.com/docs/html/...n_conditionals

So you're going to need a plugin to do the back end of whatever it is you need to do.

In a plugin this should give you the current http path (minus the bburl):
Code:

$vbulletin->input->fetch_relpath();

stuartn 07-18-2012 05:39 PM

using this in forum display and it doesn't appear to work any longer in 4.2 pl2 - any ideas and yes it has a closing if statement...
<vb:if condition="is_member_of($bbuserinfo, 1,2,3,4)">

qpurser 07-19-2012 12:24 PM

Hope somebody can help me with the following:

I have a forum called classifieds (forum id10)
This forum has 2 prefixes (only members and open to all)
Now I only want to show in this forum the ones with the prefix "only members" to the user group called "members" (user group id 9)

I guess I can do this with a conditional but not sure how to.
Also where would I put the conditional?

Thanks
Michael

chikuru 08-02-2012 06:01 PM

How can restrict signature on certain forum ID?

Example:
In forumID 2, How can I make only admin and mod's signature will be enabled, other usergroup's signature wont display?

Thanks

BirdOPrey5 08-02-2012 07:37 PM

Look in the postbit or postbit_legacy template for the signature code:

There is already a conditional you can edit:

Code:

<vb:if condition="$post['signature']">

To allow the signatures on all forums except forum 2

Code:

<vb:if condition="$post['signature'] AND $thread['forumid'] != 2">

To allow the signatures on all forums except forum 2, but OK in forum 2 is staff

Code:

<vb:if condition="$post['signature'] AND ($thread['forumid'] != 2 OR is_member_of($post, 5,6,7))">

I haven't tested this but try it. If not it may need to be:

Code:

<vb:if condition="$post['signature'] AND ($thread['forumid'] != 2 OR in_array($post['usergroupid'], array(5,6,7)))">

chikuru 08-03-2012 06:17 AM

thanks, its working now...

BirdOPrey5 08-03-2012 01:30 PM

Well you basically have

Code:

condition="XXX"
Where XXX is something like:

Code:

$post['signature'] == 'Value'
or such.

You just need to add additional statements with AND or OR depending on what you want.

Use parentheses to keep the logic correct/easy to follow

Code:

condition="(XXX) OR ((YYY) AND (ZZZ))"
For example... if XXX is true OR if YYY and ZZZ are true regardless of the value of XXX.

Budget101 08-24-2012 03:35 PM

I would like to add an "if condition" based on style id, but am having difficulty with the correct syntax to use...

For example - if vbDefault style id =2 and NewGreat Style id = 4

I would like to be able to add an if condition to the widget templates- if browsing with vb default style id #2 - Display the widget; otherwise if browsing with NewGreat Style Id #4 - (DO Not Display the widget!)

Anyone willing to offer some assistance? Thanks so much, greatly appreciated!

Code:

<vb:if condition="$styleid=2">
Display widget
<vb:else />
Do not Display widget
</vb:else>


BirdOPrey5 08-26-2012 02:16 PM

Code:

<vb:if condition="$bbuserinfo['styleid'] == 2">

tareqbd 08-27-2012 04:36 AM

Quote:

<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>
Not working in vbulleting 4.2.0
Anybody help please.

BirdOPrey5 08-27-2012 11:12 AM

Quote:

Originally Posted by tareqbd (Post 2360348)
Not working in vbulleting 4.2.0
Anybody help please.

It works but only on some pages... use

Code:

$GLOBALS['fourmid']
instead of

Code:

$forums['forumid']
to work on all pages (forums and threads)

ChiNa 08-30-2012 05:13 PM

Thank you so much, one of the greatest so far in the articles area,,,

dougdirac 09-05-2012 04:57 AM

Is there a conditional for a forum and all its sub-forums?

vbxmod 09-07-2012 07:08 PM

Is it possible to add conditional registration usergroup submission. If the user select group x then the user will automatically added in that user group or it will go to default registration group.
Thank you for your attention.

Draffi 09-09-2012 12:24 AM

@:BBR-APBT

Thank you!

BirdOPrey5 09-11-2012 11:18 AM

Quote:

Originally Posted by vbxmod (Post 2363470)
Is it possible to add conditional registration usergroup submission. If the user select group x then the user will automatically added in that user group or it will go to default registration group.
Thank you for your attention.

No, not possible via template conditionals.

Stefan118 09-21-2012 07:20 PM

Quote:

Originally Posted by tareqbd (Post 2360348)
Not working in vbulleting 4.2.0
Anybody help please.

Use this:
<vb:if condition="in_array($GLOBALS['forumid'], array(1,2,3,))">Show this to forum 1, 2 and 3</vb:if>

instead of this:
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>


Edit: Ok, next time i will read first, and post later :)

tareqbd 09-22-2012 02:23 PM

Quote:

Originally Posted by Stefan118 (Post 2367423)
Use this:
<vb:if condition="in_array($GLOBALS['forumid'], array(1,2,3,))">Show this to forum 1, 2 and 3</vb:if>

instead of this:
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>


Edit: Ok, next time i will read first, and post later :)

Worked with BOP5's suggestion. same output from you too.
Thank you both of you.

ldma 09-26-2012 08:28 PM

Can anyone tell me how to do this...

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.
Code:
<vb:if condition="THIS_SCRIPT == 'calendar'">Show this only on calendar.php</vb:if>

...but want to do it to my VBadvance Portal page which is index.php but on my domain root, not the forum root.

dougdirac 09-26-2012 09:10 PM

Quote:

Originally Posted by ldma (Post 2368811)
Can anyone tell me how to do this...

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.
Code:
<vb:if condition="THIS_SCRIPT == 'calendar'">Show this only on calendar.php</vb:if>

...but want to do it to my VBadvance Portal page which is index.php but on my domain root, not the forum root.

I think it's the same. Just find out what index.php is setting THIS_SCRIPT equal to.

ldma 09-26-2012 09:28 PM

Wonderful.. adv_index ...thankyou!

chikuru 10-01-2012 04:36 PM

whats the conditional for this:

show this in all pages except in showthread of forum 1 and 2

the code will be placed on "below navbar banner"

BirdOPrey5 10-02-2012 08:48 PM

hmmmm... try...

Code:

<vb:if condition="THIS_SCRIPT != 'showthread' OR !in_array($GLOBALS['forumid'], array(1, 2))">
code here
</vb:if>

That will show on any page NOT a showthread page, or if it is a showthread page, as long as it's not forum 1 or forum 2.

jluerken 10-03-2012 12:23 PM

How does the template conditional need to look like if I want a text to appear if the forum is closed?

SHOW NOT abc if board is closed, ELSE show def...


All times are GMT. The time now is 02:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01756 seconds
  • Memory Usage 1,834KB
  • 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
  • (20)bbcode_code_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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