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

$smarty. unknown reference

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
fduarte42
Smarty Rookie


Joined: 09 May 2003
Posts: 8

PostPosted: Fri May 09, 2003 9:03 am    Post subject: $smarty. unknown reference Reply with quote

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
View user's profile Send private message
fduarte42
Smarty Rookie


Joined: 09 May 2003
Posts: 8

PostPosted: Fri May 09, 2003 9:49 am    Post subject: Solution Reply with quote

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! Wink
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri May 09, 2003 10:08 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
fduarte42
Smarty Rookie


Joined: 09 May 2003
Posts: 8

PostPosted: Fri May 09, 2003 11:37 am    Post subject: backticks Reply with quote

oh I like the backtick solution better than mine!

It's readable! Wink
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri May 09, 2003 12:07 pm    Post subject: Reply with quote

with "sparse" i meant the documentation for the backticks on smarty.php.net not the backticks themselves Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
xces
Smarty Regular


Joined: 09 Apr 2004
Posts: 77

PostPosted: Sat Sep 11, 2004 2:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Sun Sep 12, 2004 1:05 pm    Post subject: Reply with quote

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
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 -> Bugs 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