Jump to content

Javascript and Smarty templates problem - anyone?


simcoweb

Recommended Posts

Hi. I'm doing some modifications to Xcart changing the design and want to insert a javascript/rollover menu. There's 3 elements I have to content with. The first goes in the <head> section. However, when I insert it I get a Smarty error. Here's the section of the cart that deals with the <head> section. This includes my inserted javascript you'll notice.

 

{* $Id: home.tpl,v 1.19.2.5 2006/10/24 13:46:18 svowl Exp $ *}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{if $printable ne ''}
{include file="customer/home_printable.tpl"}
{else}
{config_load file="$skin_config"}
<html>
<head>
<title>
{if $config.SEO.page_title_format eq "A"}
{section name=position loop=$location}
{$location[position].0|strip_tags|escape}
{if not %position.last%} :: {/if}
{/section}
{else}
{section name=position loop=$location step=-1}
{$location[position].0|strip_tags|escape}
{if not %position.last%} :: {/if}
{/section}
{/if}
</title>
<script type="text/javascript">
<!--

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
contact_over = newImage("images/contact-over.gif");
cart_over = newImage("images/cart-over.gif");
reseller_over = newImage("images/reseller-over.gif");
preloadFlag = true;
}
}

// -->
</script>

{include file="meta.tpl" }
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}" />

</head>

 

The error it's throwing is this:

 

Error: Smarty error: [in customer/home.tpl line 25]: syntax error: unbalanced parenthesis in if statement (Smarty_Compiler.class.php, line 1265) in /home2/wwwtren/public_html/Smarty-2.6.12/Smarty.class.php on line 1095

 

For some reason Smarty is trying to parse the 'if' statements as though they were {if} statements instead of just reading the functions between the <script> tags.

 

Anyone have any ideas/help/fixes for this? Thanks in advance!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.