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

[Array] Problem with an array

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


Joined: 15 Apr 2004
Posts: 6

PostPosted: Thu Jun 10, 2004 9:06 am    Post subject: [Array] Problem with an array Reply with quote

Hello,

In tpl file, $obj is an object with val an attribut of this object and val an Integer value, why this is wrong :

Code:

...
 { $tab[$obj->val] }
...


Thank
Seb
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Thu Jun 10, 2004 2:31 pm    Post subject: Reply with quote

That syntax just isn't supported. Within brackets very little is supported, in fact. You will have to use an intermediate:

Code:
{assign var=temp val=$obj->val}
{$tab[$temp]} or {$tab.$temp}
Back to top
View user's profile Send private message
cibouseb
Smarty Rookie


Joined: 15 Apr 2004
Posts: 6

PostPosted: Thu Jun 10, 2004 2:35 pm    Post subject: Reply with quote

Thanks. it 's ok now with your help.

bye
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 -> Smarty Development 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