|
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 |
Squee-D Smarty n00b
Joined: 24 Jun 2003 Posts: 4 Location: Waipu, New Zealand
|
Posted: Tue Jul 15, 2003 11:17 am Post subject: inserting vars as part of the name of another var |
|
|
I have a question or two, perhaps this belongs in a faq?
1. if i want to reference an associative array key using a smarty template, how would I do that?
eg: {$my_assoc_array.$some.ref}
so if $some.ref == "item"
then I would get the result as if i entered {$my_assoc_array.item}
2. Similarily, if I want to use one var to substitute part of the name of another variable, how would I do that?
eg: {$my_`$inject.name'_bar}
so if $inject.name == 'foo'
i would really be asking for {$my_foo_bar}
Notice in both cases my 'injected' variable is actually an object, to complicate things just a little _________________ Yours,
Rasheed Abdal-Aziz
System Architect
Simtrek P/L
rasheed@simtrek.com |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Jul 16, 2003 9:05 am Post subject: |
|
|
1. http://www.phpinsider.com/smarty-forum/viewtopic.php?t=320
2. is an excercise for the reader . It occurs to me that there may be a straightforward answer for this but I'm obviously too tired to think of it--all that is coming to me at the moment are methods too cumbersome to mention. |
|
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
|