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

quotes in function calls

 
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 -> General
View previous topic :: View next topic  
Author Message
kynan
Smarty n00b


Joined: 23 Apr 2003
Posts: 4
Location: Sydney, Australia

PostPosted: Thu Apr 24, 2003 5:01 am    Post subject: quotes in function calls Reply with quote

I seem to be having a problem no one else is so it's probably something I'm doing. I'm only using the demos at the moment, but none of them work unless I take out the quotes around the attribute values in the function calls.

This throws an error and excecution stops:

{include file="header.tpl"}

This works fine:

{include file=header.tpl}

This happens with all functions any quotes at all. An example:

{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"}

results in the error:

Fatal error: Smarty: [in file:/home/www/00/kerrynettle.org.au/smarty/debug.tpl line 7]: syntax error: unidentified token '\"html\"' (Smarty_Compiler.class.php, line 1228) in /home/www/00/kerrynettle.org.au/smarty/Smarty_Compiler.class.php on line 1824

Another strange development is that this has just stopped happening on one development machine, but is still happening on another.

Can anyone shed some light on this?

Kynan
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Apr 24, 2003 5:16 am    Post subject: Reply with quote

what versions of smarty are each environment running?
Back to top
View user's profile Send private message
kynan
Smarty n00b


Joined: 23 Apr 2003
Posts: 4
Location: Sydney, Australia

PostPosted: Mon Apr 28, 2003 5:39 am    Post subject: Smarty-2.5.0.1 Reply with quote

Smarty-2.5.0.1 on both.

Have almsot got around it by taking out most of the quotes but am getting a error still on a regexp:

http://www.kerrynettle.org.au/index.php

Kynan
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Apr 28, 2003 7:55 am    Post subject: Re: Smarty-2.5.0.1 Reply with quote

kynan wrote:
Smarty-2.5.0.1 on both.

Have almsot got around it by taking out most of the quotes but am getting a error still on a regexp:

http://www.kerrynettle.org.au/index.php

Kynan


Perhaps you can post some relevant source code where things seem to start breaking. Its kinda hard to tell so far.
Back to top
View user's profile Send private message
kynan
Smarty n00b


Joined: 23 Apr 2003
Posts: 4
Location: Sydney, Australia

PostPosted: Tue Apr 29, 2003 2:11 am    Post subject: Reply with quote

This error:

Fatal error: Smarty: [in /home/www/00/kerrynettle.org.au/smarty/kerry/templates/header.tpl line 48]: syntax error: invalid attribute name: 'mainMenu\' (Smarty_Compiler.class.php, line 1334) in /home/www/00/kerrynettle.org.au/smarty/Smarty_Compiler.class.php on line 1824

Comes from this url:

http://www.kerrynettle.org.au/index.php


Is caused by this bit of the template:


{section name="mainMenu" loop=$mainMenuItems}
{if $mainMenuItems[mainMenu]|regex_replace:"/\+/":" " == $deptName}
<td class="menuHighlight" valign="middle" nowrap>&&&{$mainMenuItems[mainMenu]}&&&</td>
{else}
<td class="darkBg" valign="middle" nowrap><a href="index.php?dept={$mainMenuItems[mainMenu]}" class="menu">&&&{$mainMenuItems[mainMenu]}&&n
bsp;&</a></td>
{/if}
{/section}

If I take out the quotes which are causing the errors then the next ones at regex_replace:"/\+/":" " cause an error.

Thanks for your help. I have include the full code of the template in case it's relevant. But even the demo ones are causing this error, so I think th e problem is likely to somewhere else.

Kynan


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Senator Kerry Nettle</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="197" align="left" valign="top" class="banner">
<form action="http://www.google.com/search" name=f onSubmit="this.q.value=this.q.value + ':kerrynettle.org.au'">
<table width="200" border="0" cellspacing="0" cellpadding="10">
<tr>
<td class="banner">
<input maxLength=256 size=20 name=q value="">
<input type=hidden name=ie value="ISO-8859-1">
<input name=hl type=hidden value=en>
</td>
<td class="banner">
<input type=submit value="search" name=btnG>
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td height="6" background="images/000_blueSpacer.gif" bgcolor="#2C2D46"></td>
</tr>
<tr>
<td height="1" background="images/shim.gif" bgcolor="#ffffff"></td>
</tr>
<tr>
<td>
<!-------------- MENU -------------->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="20" valign="middle" class="menu">
<!-------------- MAIN MENU -------------->
<table border="0" cellpadding="0" cellspacing="0">
<tr>

{section name="mainMenu" loop=$mainMenuItems}
{if $mainMenuItems[mainMenu]|regex_replace:"/\+/":" " == $deptName}
<td class="menuHighlight" valign="middle" nowrap>&&&{$mainMenuItems[mainMenu]}&&&</td>
{else}
<td class="darkBg" valign="middle" nowrap><a href="index.php?dept={$mainMenuItems[mainMenu]}" class="menu">&&&{$mainMenuItems[mainMenu]}&&&</a></td>
{/if}
{/section}
<!--<td class="menu" valign="middle" nowrap>--><!--</td>-->
</tr>
</table>
<!-------------- / MAIN MENU -------------->
</td>
</tr>
<tr>
<td height="30">
<!-------------- SUB MENU -------------->
<table border="0" cellpadding="0" cellspacing="0">
<tr>

{section name=subMenu loop=$subMenuItems}
{if $subMenuItems[subMenu] == $deptItem}
<td class="subMenuHighlight" valign="middle" nowrap>&&&{$subMenuItems[subMenu]}&&&&</td>
{else}
<td class="lightBg" valign="middle" nowrap><a href="index.php?dept={$deptName}&deptItem={$subMenuItems[subMenu]}" class="subMenu">&&&{$subMenuItems[subMenu]}&&&&</a></td>
{/if}
{/section}
<!--
<td class="subMenuHighlight" valign="middle" nowrap>&&&No War on Iraq&&&&</td>
<td class="lightBg" valign="middle" nowrap><a href="" class="subMenu">&&&GE food&&&&</a></td>
<td class="lightBg" valign="middle" nowrap><a href="" class="subMenu">&&&Free West Papua&&&&</a></td>
<td class="lightBg" valign="middle" nowrap><a href="" class="subMenu">&&&&Asylum Seekers&&&</a></td>
-->
</tr>
</table>
<!-------------- / SUB MENU -------------->
<p class="darkBg">&</p></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<!-------------- /MENU -------------->
</td>
</tr>
<tr>
<td class="bannerSpacer">
<!------------------- BODY ------------------->
<!------------------ / BODY ------------------>
</td>
</tr>
</table>
</body>
</html>
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 29, 2003 3:07 am    Post subject: Reply with quote

Hi kynan;

Code:
Smarty-2.5.0.1 on both.


What version is that? On http://smarty.php.net/download.php the latest is 2.5.0. If you are using a CVS version, then try reverting back to 2.5.0. Both the CVS and 2.5.0 version work on my w2k box without issue.

I have tried your example code on my site and I'm almost sorry to say that it worked as expected. You said the supplied examples aren't working either. Perhaps you have a setup issue as you suggest. Platform??

What else is going on in your code / smarty application? Are you using filters? Does anything work in Smarty?? Have you looked at the compiled file output to see what is going on in there?

As an aside, you might want to reconsider using the &'s in your HTML as they are considered an entity in HTML and should be indicated as & amp; (but without the space, this bb converts it if I don't use the space--perhaps your code was converted when you posted it!)

Anyhow, I can't repeat this problem with the info you gave me so far Sad.
Back to top
View user's profile Send private message
kynan
Smarty n00b


Joined: 23 Apr 2003
Posts: 4
Location: Sydney, Australia

PostPosted: Tue Apr 29, 2003 1:32 pm    Post subject: Reply with quote

Thanks for taking the time to look into it. I'm not surprised you can't replicate the problem. As I say, it only happens on the live server not my development machine, and it happens with all the demo templates - even the debug one.

By the way, I am using 2.5.0 - when it decompressed I already had a version called 2.5.0 so it was named 2.5.0.1 ( silly me ).

I'm running MacOSX - no problems ( except when downloading from http://smarty.php.net the file is saved as the name of the download script - downloader.php or something. I had to rename it blahh.tar.gz to decompress it. Might confuse some people ).

Finally, the only thing I can think of is that the live server ( running some *nix flav.) is running PHP through a wrapper of their own devising so that it gets run as user me not the webserver. I've got a feeling in my gut that this is what's causing the problem. If you've noticed this before please let me know.

Thanks once again for your time.

Kynan
Back to top
View user's profile Send private message Visit poster's website
andre
Smarty Pro


Joined: 23 Apr 2003
Posts: 164
Location: Karlsruhe, Germany

PostPosted: Tue Apr 29, 2003 1:42 pm    Post subject: Reply with quote

Are you using any Smarty prefilters or something like that? Or perhaps could it be some kind of magic slashes added to the quotes? Something like magic_quotes_runtime is set to TRUE? That would explain why smarty outputs
Quote:
error: unidentified token '\"html\"'

(Notice the backslashes!!!)
Back to top
View user's profile Send private message
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 -> General 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