vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   need a quick if statement pls (https://vborg.vbsupport.ru/showthread.php?t=62350)

corsacrazy 03-10-2004 12:19 PM

need a quick if statement pls
 
i wont to only show sumthing to 3 usergoups how would i structure the IF in the vb3 template ?


<if usergroup== 1,2,3(usergroupid) MY CODE HERE</if>

NTLDR 03-10-2004 12:37 PM

HTML Code:

<if condition="in_array($bbuserinfo['usergroupid'], array(1,2,3))">stuff</if>

corsacrazy 03-10-2004 12:43 PM

so i replcace 123 with the usergroup ids i want info to be displayed to :D cheers boss

NTLDR 03-10-2004 12:43 PM

Yep, just put your own comma seperated list of ids :)

corsacrazy 03-10-2004 01:16 PM

sorted werks gr8 mate cheers

AN-net 03-10-2004 07:42 PM

question, if we had an array set in the php code how would the if statement in the template look?

Boofo 03-10-2004 07:51 PM

PHP Code:

if (in_array($bbuserinfo['usergroupid'], array(1,2,3)))
{
stuff



NTLDR 03-10-2004 08:41 PM

Quote:

Originally Posted by AN-net
question, if we had an array set in the php code how would the if statement in the template look?

PHP Code:


// code above
$var = array('value''value2''value3');
// code bellow 

HTML Code:

<if condition="in_array($somevar, $var)">stuff</if>
Note this will probably tell you there is an error with a conditional in the template when saving due to the fact that $var hasn't been set and thus may not be an array, just ignore it ;)

filburt1 03-10-2004 09:14 PM

Quote:

Originally Posted by NTLDR
PHP Code:


// code above
$var = array('value''value2''value3');
// code bellow 

HTML Code:

<if condition="in_array($somevar, $var)">stuff</if>
Note this will probably tell you there is an error with a conditional in the template when saving due to the fact that $var hasn't been set and thus may not be an array, just ignore it ;)

If you want to include non-primary usergroups, you should probably use:
Code:

<if condition="is_member_of($array_with_userid_key, usergroupid)
or is_member_of($array_with_userid_key, usergroupid) or ...
contents
</if>

If you're just checking if the user is a moderator or higher, use:
Code:

<if condition="can_moderate()">
.
.
.
</if>


corsacrazy 03-10-2004 09:24 PM

hey filb hows the VBMS for vb3 going?


All times are GMT. The time now is 10:26 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.01167 seconds
  • Memory Usage 1,738KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_html_printable
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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