|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
zelen0 Smarty n00b
Joined: 03 Oct 2003 Posts: 2
|
Posted: Sat Oct 04, 2003 4:45 pm Post subject: unbalanced parenthesis error and how to resolve? |
|
|
I just installed Smarty and am trying something just basic, using the include statement, but it's breaking with just a simple include. This is the error:
<b>Fatal error</b>: Smarty: [in virus.js line 4]: syntax error: unbalanced parenthesis in if statement (Smarty_Compiler.class.php, line 1147) in Sites/Smarty-2.6.0-RC1/libs/Smarty_Compiler.class.php on line 2040
This is the header.tpl file
Code: |
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1" />
{include file="virus.js"}
<TITLE>{$title}</TITLE>
</HEAD>
|
and this is the virus.js first 6 lines, it reports the error on the 4th line:
Code: |
1:<SCRIPT TYPE="text/javascript">
<!--
2:
3:function newImage(arg) {
4: if (document.images) {
5: rslt = new Image();
6: rslt.src = arg;
7: return rslt;
8: }
9:}
|
What gives? This code works perfectly, and why is Smarty even checking the javascript code, shouldn't it just include it blindly regardless of contents? How do I resolve this?
Any help is greatly appreciated, I've resorted to pre-Smarty of including the code in the main header.tpl file itself. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat Oct 04, 2003 8:50 pm Post subject: Re: unbalanced parenthesis error and how to resolve? |
|
|
zelen0 wrote: | ...and why is Smarty even checking the javascript code, shouldn't it just include it blindly regardless of contents? |
because it contains smarty's left_delimiter "{". everything after "{" is considered a smarty tag. you have two options: change the left- and right_delimiter or use {literal}. |
|
Back to top |
|
zelen0 Smarty n00b
Joined: 03 Oct 2003 Posts: 2
|
Posted: Sun Oct 05, 2003 6:52 am Post subject: |
|
|
yeah I finally figured out I had to add {literal} to the top of any javascript file that is included.
Is it possible to have include_literal as a built-in function? that would probably be useful? How do you or others handle Javascripts? Do you include them? Do you add {literal} to each javascript file? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun Oct 05, 2003 7:22 am Post subject: |
|
|
You could use {fetch} instead of {include} |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|