vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Template Problem (https://vborg.vbsupport.ru/showthread.php?t=241906)

ckgreenman 05-05-2010 11:57 AM

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:

https://vborg.vbsupport.ru/external/2010/05/57.png

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.

Lynne 05-05-2010 01:25 PM

What is the code you are adding that seems to be causing the problem?

ckgreenman 05-05-2010 03:07 PM

Quote:

Originally Posted by Lynne (Post 2032114)
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?

Deceptor 05-05-2010 03:44 PM

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>

ckgreenman 05-05-2010 04:17 PM

Quote:

Originally Posted by Deceptor (Post 2032172)
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?

Deceptor 05-05-2010 04:24 PM

You might wanna post the template here then (or the offending part) otherwise we can't help much.

ckgreenman 05-05-2010 04:41 PM

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.

Lynne 05-05-2010 06:09 PM

put <vb:literal> and </vb:literal> around your javascript.

ckgreenman 05-06-2010 12:51 PM

Lynne, That seems to have fixed it. Thanks a bunch. :D


All times are GMT. The time now is 10:37 AM.

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.01035 seconds
  • Memory Usage 1,737KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete