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

Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2010, 11:57 AM
ckgreenman ckgreenman is offline
 
Join Date: Feb 2009
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Template Problem

Hello, I'm attempting to port a mod (someone else's) to VB4 and I'm having a problem with one of the templates.


The mod has a main templates and calls the other templates using variables. I modified the main template and the php file so that the variables are now registered and the sub templates are called using the {vb:raw } syntax. The problem is in one of the sub templates I need to pass variables to it as well but as soon as I try to specify a {vb: } type variable (even stylevars) it won't let me save the template. I get the following error:

Code:
Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3332
and the following dialog:



Any any ideas where the problem might be?

Thanks.


EDIT: I checked and as far as I'm aware of there are no if statements in the template.
Reply With Quote
  #2  
Old 05-05-2010, 01:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is the code you are adding that seems to be causing the problem?
Reply With Quote
  #3  
Old 05-05-2010, 03:07 PM
ckgreenman ckgreenman is offline
 
Join Date: Feb 2009
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
What is the code you are adding that seems to be causing the problem?
What triggers it is {vb: anything. I did a test adding {} then {vb} then {vb:} and the last one triggered it.

I found a work around though. There was some javascript in the template so I pulled all of it out and put it into a new template then called IT from the main template and now I can save the original template without error.

EDIT:
The problem is definitely in the javascript somewhere. The javascript is needing variables from the PHP file but when I try to reference the variable using {vb:raw variablename} i get the same error when I save the template.

I poked through the javascript and everything LOOKS ok but I'm no expert. Is there anything I should keep an eye out for?
Reply With Quote
  #4  
Old 05-05-2010, 03:44 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had a similar error pop up not so long ago. Check that the "<vb:if condition>" tags are all written correctly, since that's what caused the same error when I was porting templates and had missed one.

In vB3 it's: <if condition="...."><else /></if>
In vB4 it's: <vb:if condition="...."><vb:else /></vb:if>
Reply With Quote
  #5  
Old 05-05-2010, 04:17 PM
ckgreenman ckgreenman is offline
 
Join Date: Feb 2009
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Deceptor View Post
I had a similar error pop up not so long ago. Check that the "<vb:if condition>" tags are all written correctly, since that's what caused the same error when I was porting templates and had missed one.

In vB3 it's: <if condition="...."><else /></if>
In vB4 it's: <vb:if condition="...."><vb:else /></vb:if>

I'm not using HTML <if> statements though. The template in question consists entirely of javascript (with the addition of the <script></script> tags). How would that apply?
Reply With Quote
  #6  
Old 05-05-2010, 04:24 PM
Deceptor's Avatar
Deceptor Deceptor is offline
 
Join Date: Dec 2008
Location: England
Posts: 514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You might wanna post the template here then (or the offending part) otherwise we can't help much.
Reply With Quote
  #7  
Old 05-05-2010, 04:41 PM
ckgreenman ckgreenman is offline
 
Join Date: Feb 2009
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok this is enough to generate the issue

Code:
	  <script type="text/javascript">
	  //<![CDATA[
	  window.onload=Load_Map

	  function get_icon(type) {
		var color;
		if ((typeof(type)=="undefined") || (type==null)) 
		{ 
		color = "red" 
		} 
		else { 
		color = type 
		}
		var icon = new GIcon();

		icon.image = "$bburl/images/googlemapme/mm_20_"+ color +".png"; 
	

		icon.shadow = "$bburl/images/googlemapme/mm_20_shadow.png";
		icon.iconSize = new GSize(12, 20);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GLatLng(20, 2);
		icon.infoWindowAnchor = new GLatLng(1, 5);
		return icon;
	
	  }
	  
		 	  //]] </script>
As written it saves fine but if I add a vb variable (for example {vb:raw map_type}) then it won't save.
Reply With Quote
  #8  
Old 05-05-2010, 06:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

put <vb:literal> and </vb:literal> around your javascript.
Reply With Quote
  #9  
Old 05-06-2010, 12:51 PM
ckgreenman ckgreenman is offline
 
Join Date: Feb 2009
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne, That seems to have fixed it. Thanks a bunch.
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 01:51 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.10873 seconds
  • Memory Usage 2,243KB
  • 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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete