vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   vBulletin Template Conditionals (https://vborg.vbsupport.ru/showthread.php?t=215032)

BirdOPrey5 12-23-2010 04:16 PM

Quote:

Originally Posted by azn_romeo_4u (Post 2138141)
How do you do this for arrays?



Like more than one forums.

Quote:

Originally Posted by popowich (Post 2138148)
Multiple usergroups, forums, etc syntax looks like :

<if condition="is_member_of($vbulletin->userinfo, 5,6,8)">

Actually that is_member_of is a function specific to usergroups...

In general to do this for arrays it would be:

Code:

<if condition="in_array($forum[forumid], array(2, 3, 4, 5, 6 ))">
and for !=

Code:

<if condition="!in_array($forum[forumid], array(2, 3, 4, 5, 6 ))">

AlexisMedia 12-25-2010 05:21 PM

I'm trying to find the conditional to include "in every forum except (several forums). I wasn't sure what the "!=" meant but I thought that might be it so I tried this but it was a no-go.

Code:

<vb:if condition="!in_array($foruminfo[forumid], array(26, 46 )">MyScript</vb:if>
Any ideas on how I could do that? Thanks!

I'm using vB4....

Lynne 12-25-2010 05:56 PM

Quote:

Originally Posted by AlexisMedia (Post 2138959)
I'm trying to find the conditional to include "in every forum except (several forums). I wasn't sure what the "!=" meant but I thought that might be it so I tried this but it was a no-go.

Code:

<vb:if condition="!in_array($foruminfo[forumid], array(26, 46 )">MyScript</vb:if>
Any ideas on how I could do that? Thanks!

I'm using vB4....

That may not be a valid variable to use in that template. What template are you trying to put it in (take a look at the template itself and see what variable is being used there).

(Also, this is a vB3 article, although most of the conditions are valid, but in vB4 it does matter what template you use a variable in.)

AlexisMedia 12-25-2010 06:02 PM

I was using it in the same FORUM DISPLAY template that we changed that variable to fix. Sorry I posted in the vB3 article. I didn't realize it till after I had done it but then figured it was still my best chance because the post just before seemed to relate.

I tried posting in my other thread but it did that auto-merge again : (

(but I see you found it anyways...LOL.)

BirdOPrey5 12-25-2010 09:50 PM

The VB4 version of this thread is here. I don't want to talk about VB4 in a VB3 thread. If you're still having issues please post in the VB4 thread for help.

AlexisMedia 12-26-2010 12:02 AM

Yes, I apologize. I didn't realize it when I first typed my post... Then I left it.

Moving on...

nikki712 02-03-2011 01:15 PM

I want to exclude the forums listed below. But when I use this conditional, I get an error. What am I doing wrong? I'm running 3.8.6 PL1

Code:

<if condition="$forum[forumid] != 1,2,3,4">google ad code here</if>
It's not working.

I get the error:

Code:

The following error occurred when attempting to evaluate this template:

Parse error: syntax error, unexpected ',' in /home/xxxxxxxx/public_html/forum/includes/adminfunctions_template.php(3950) : eval()'d code on line 1

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

How can I fix this? Is the fact that I run vbseo a problem?

I'd also like to exclude certain usergroups from seeing ads. How do I accomplish both of these things?

BirdOPrey5 02-03-2011 01:48 PM

What's wrong is your condition is wrong... it should look like this:

Code:

<if condition="!in_array($forum['forumid'], array(1,2,3,4))"></if>

nikki712 02-03-2011 01:52 PM

Thanks! Is there a way to use two conditionals? I don't want ads showing up in certain forums, and there's on particular usergroup that I want to block ads from. Is this possible?

BirdOPrey5 02-03-2011 02:34 PM

Code:

<if condition="!in_array($forum['forumid'], array(1,2,3,4)) AND !is_member_of($vbulletin->userinfo, 5,6)">
That won't show it in forums 1, 2, 3, or 4 and won't show it to anyone in usergroups 5 or 6.


All times are GMT. The time now is 07:36 PM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02053 seconds
  • Memory Usage 1,744KB
  • 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
  • (8)bbcode_code_printable
  • (3)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
  • (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