Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

unbalanced parenthesis error and how to resolve?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
zelen0
Smarty n00b


Joined: 03 Oct 2003
Posts: 2

PostPosted: Sat Oct 04, 2003 4:45 pm    Post subject: unbalanced parenthesis error and how to resolve? Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Oct 04, 2003 8:50 pm    Post subject: Re: unbalanced parenthesis error and how to resolve? Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
zelen0
Smarty n00b


Joined: 03 Oct 2003
Posts: 2

PostPosted: Sun Oct 05, 2003 6:52 am    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sun Oct 05, 2003 7:22 am    Post subject: Reply with quote

You could use {fetch} instead of {include}
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP