Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2009, 11:42 AM
Saviour's Avatar
Saviour Saviour is offline
 
Join Date: Apr 2007
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Coding issue...

I have a dropdown call template and below is the code in the template:

Code:
<!-- post specs_menu -->
<if condition="$post['field23']">
	<div style="background-image: url('http://glitchpc.com/forums/images/buttons/specs.gif'); position:absolute; width:auto;" id="specs_$post[postid]" class="vbmenu_control">
		<a href="#specs">$vbphrase[dropdown_title]</a> 
		<script type="text/javascript"> vbmenu_register("specs_$post[postid]"); </script>
	</div>
</if>
<!-- / post specs_menu -->

I want to exclude certain forums from using this code (or calling the template)...so I tried the following and I get a parse error...malformed conditional.

Code:
<!-- post specs_menu -->
<if condition="$forum[forumid] != XX">
<if condition="$post['field23']">
	<div style="background-image: url('http://glitchpc.com/forums/images/buttons/specs.gif'); position:absolute; width:auto;" id="specs_$post[postid]" class="vbmenu_control">
		<a href="#specs">$vbphrase[dropdown_title]</a> 
		<script type="text/javascript"> vbmenu_register("specs_$post[postid]"); </script>
	</div>
</if>
</if>
<!-- / post specs_menu -->

The code above will work with one forum...where the forum ID is "XX". However, if I add another forum ID after the XX (separated by a comma) the conditional fails...malformed syntax.

Can someone help me correct this?

Thank you.
Reply With Quote
  #2  
Old 06-08-2009, 01:15 PM
Choo Choo is offline
 
Join Date: Mar 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I understand you correctly, you shoul write something like that.
Code:
<if condition="$forum[forumid] != XX || $forum[forumid] != YY">
Reply With Quote
  #3  
Old 06-08-2009, 01:48 PM
Saviour's Avatar
Saviour Saviour is offline
 
Join Date: Apr 2007
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Choo...thanks for the reply...

Nope...that didn't work, either...
Reply With Quote
  #4  
Old 06-08-2009, 02:04 PM
Choo Choo is offline
 
Join Date: Mar 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But it should work . Show your code. But that's not really proper variant. Try this.
Code:
$ids = array(123, 234, 345); //forums ids
<if condition="!in_array($forum[forumid], $ids)">
Reply With Quote
  #5  
Old 06-08-2009, 02:07 PM
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Location: Texas
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Choo, you have the right idea, but the $ids must be in a php script, or if you have a setting group in vBulletin Options, you could do $vboptions['setting_name'] for the $ids replacement.
Reply With Quote
  #6  
Old 06-08-2009, 02:39 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should work for an array of forumids:
HTML Code:
<if condition="in_array($forum['forumid'], array(xx,yy,zz))">
whatever
</if>
Reply With Quote
  #7  
Old 06-08-2009, 02:58 PM
Saviour's Avatar
Saviour Saviour is offline
 
Join Date: Apr 2007
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay...here's what I'm using...and I'm getting a parse error...

Code:
<!-- post specs_menu -->
$ids = array(8, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66); //forums ids
<if condition="!in_array($forum[forumid], $ids)">
<if condition="$post['field23']">
	<div style="background-image: url('http://glitchpc.com/forums/images/buttons/specs.gif'); position:absolute; width:auto;" id="specs_$post[postid]" class="vbmenu_control">
		<a href="#specs">$vbphrase[dropdown_title]</a> 
		<script type="text/javascript"> vbmenu_register("specs_$post[postid]"); </script>
	</div>
</if>
</if>
<!-- / post specs_menu -->
Thanks for the help, everyone...

Hi, Lynne...

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

Tried this, as well...still no workie...heh:

Code:
<!-- post specs_menu -->
<if condition="in_array($forum['forumid'], array(8,56,58,59,60,61,62,63,64,65,66))">
<if condition="$post['field23']">
	<div style="background-image: url('http://glitchpc.com/forums/images/buttons/specs.gif'); position:absolute; width:auto;" id="specs_$post[postid]" class="vbmenu_control">
		<a href="#specs">$vbphrase[dropdown_title]</a> 
		<script type="text/javascript"> vbmenu_register("specs_$post[postid]"); </script>
	</div>
</if>
</if>
<!-- / post specs_menu -->
Reply With Quote
  #8  
Old 06-08-2009, 04:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try combining the two ifs, like suggest above. It also helps to know the exact error you are getting or if it's not working, exactly what you see is not working.
Reply With Quote
  #9  
Old 06-08-2009, 04:29 PM
Saviour's Avatar
Saviour Saviour is offline
 
Join Date: Apr 2007
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't take it for granted that because I have the word "Coder" under my username that I have a clue as to what you mean by combining the IF statements...sorry.

In this particular case...I get a parse error...I don't have the exact code...but it does refer to it being a conditional error. So...I'm assuming it has something to do with the way it's coded.
Reply With Quote
  #10  
Old 06-08-2009, 04:40 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To combine two conditions, you just add an AND (or sometimes an OR, it depends on what you want) between the two. Remove the extra </if> after you combine them.
HTML Code:
<if condition="in_array($forum['forumid'], array(8,56,58,59,60,61,62,63,64,65,66)) AND $post['field23']">
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 02:53 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.07095 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (2)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete