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

{assign}- how to escape the '=' sign

 
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
webflicker
Smarty n00b


Joined: 14 Feb 2012
Posts: 2

PostPosted: Tue Feb 14, 2012 10:30 am    Post subject: {assign}- how to escape the '=' sign Reply with quote

Hi there

I would like to assing url link to variable
ex.:
var = page
value = "emails.php?zone=$_GET['zone']"

{assign var=page value=`emails.php?zone=``$smarty.get.Zone`}

I get this error:
Fatal error: Smarty error: [in emails.tpl line 51]: syntax error: invalid attribute name: '=' (Smarty_Compiler.class.php, line 1559) in C:\xampp\htdocs\allenford_new\website\lib\smarty\Smarty.class.php on line 1092

if I use the same function with the '= sign' all is OK
{assign var=page value=`emails.php?zone``$smarty.get.Zone`}

How do escape the = sign?

Your help is much appreciated
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Tue Feb 14, 2012 10:47 am    Post subject: Reply with quote

How about properly delimiting your strings?
Code:
{assign var=page value="emails.php?zone=`$smarty.get.Zone`"}


This is exceptionally bad, as $smarty,get.Zone is not escaped properly. If you're dealing with Smarty3 try
Code:
{$page = "emails.php?zone={$smarty.get.Zone|escape:'url'}"}
if you're dealing with Smarty2 try
Code:
{assign var="page" value=$smarty.get.Zone|escape:"url"}
{assign var="page" value="emails.php?zone=`$page`"}

_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
webflicker
Smarty n00b


Joined: 14 Feb 2012
Posts: 2

PostPosted: Tue Feb 14, 2012 10:58 am    Post subject: Reply with quote

Many thanks rodneyrehm

Your correction worked for me.
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