|
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 |
fduarte42 Smarty Rookie
Joined: 09 May 2003 Posts: 8
|
Posted: Fri May 09, 2003 9:03 am Post subject: $smarty. unknown reference |
|
|
Hi!
I updated from smarty 2.4.2 to smarty 2.5.0 and found the following bug:
Is used to write: {assign var="user2" value="$smarty.request.user1"}
That does not work anymore! It causes a "$smarty. unkown reference error"
What shall i do, and how do i concatenate a varaiable and a String in a Paraneter: i.e. value="$smarty.request.user"."test" or so!
Thx for help and keep up the great work! |
|
Back to top |
|
fduarte42 Smarty Rookie
Joined: 09 May 2003 Posts: 8
|
Posted: Fri May 09, 2003 9:49 am Post subject: Solution |
|
|
I found a Solution:
{assign var="user2" value="$smarty.request.user1"}
changed to
{assign var="user2" value=$smarty.request.user1}
and to concatenate i use:
{assign var="user2" value="("|cat:$smarty.request.user1|cat:")"}
Sometimes its so easy! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri May 09, 2003 10:08 am Post subject: |
|
|
you can also surround the variable by backticks:
{assign var="user2" value="(`$smarty.request.user1`)"}
without backticks only "$smarty" is recognized as the variable, and the dot is assumed belonging to the string.
see:
http://smarty.php.net/manual/en/language.syntax.quotes.php
but it's a bit sparse, i know. |
|
Back to top |
|
fduarte42 Smarty Rookie
Joined: 09 May 2003 Posts: 8
|
Posted: Fri May 09, 2003 11:37 am Post subject: backticks |
|
|
oh I like the backtick solution better than mine!
It's readable! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri May 09, 2003 12:07 pm Post subject: |
|
|
with "sparse" i meant the documentation for the backticks on smarty.php.net not the backticks themselves |
|
Back to top |
|
xces Smarty Regular
Joined: 09 Apr 2004 Posts: 77
|
Posted: Sat Sep 11, 2004 2:46 pm Post subject: |
|
|
following code is also causing thesame error:
syntax error: $smarty. is an unknown reference (Smarty_Compiler.class.php, line 2046)
Code: | {section name=tr loop=$arrLinks step=3}
{strip}
{section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+3}
...
{/section}
{/strip}
<br class="clearboth" />
{/section} |
(Error is raised on line 3 from above code)
Code: | {math equation="x + y" x=$smarty.section.tr.index y=3 assign=blaat}
{section name=td start=$smarty.section.tr.index loop=$blaat} |
^^ SOLLUTION ^^ |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Sun Sep 12, 2004 1:05 pm Post subject: |
|
|
have you tested somethink like that:
Code: |
{section name=td start=$smarty.section.tr.index loop=`$smarty.section.tr.index+3`}
|
I think it should work too, but i`m not sure |
|
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
|