|
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 |
webflicker Smarty n00b
Joined: 14 Feb 2012 Posts: 2
|
Posted: Tue Feb 14, 2012 10:30 am Post subject: {assign}- how to escape the '=' sign |
|
|
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 |
|
rodneyrehm Administrator
Joined: 30 Mar 2007 Posts: 674 Location: Germany, border to Switzerland
|
Posted: Tue Feb 14, 2012 10:47 am Post subject: |
|
|
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 |
|
webflicker Smarty n00b
Joined: 14 Feb 2012 Posts: 2
|
Posted: Tue Feb 14, 2012 10:58 am Post subject: |
|
|
Many thanks rodneyrehm
Your correction worked for me. |
|
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
|