|
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 |
datenpunk Smarty Rookie
Joined: 17 May 2003 Posts: 6
|
Posted: Fri Jun 27, 2003 11:25 pm Post subject: Variable variables in a template |
|
|
Hello,
is there a way to have dynamic variable names in smarty.
e.g.
1. assign $cLANG to 'EN'
template:
$ItemDescription_$cLANG
now I want smarty to output the value of
$ItemDescription_EN
I don't want to use if's for that and there is no way to make an array looking like $ItemDescription[$cLANG].
Any chance for me to solve this?
Thanks in advance
Daniel Khan |
|
Back to top |
|
bkatsma Smarty n00b
Joined: 30 Jun 2003 Posts: 3
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Jun 30, 2003 5:22 pm Post subject: |
|
|
@datenpunk: this is not easily possible, maybe only with some ugly custom plugins/modifiers.
you are best of using another format for your data, that suits better to smarty or do the conversion in php and not in smarty.
for example: if you don't have $ItemDescription_EN and $ItemDescription_DE etc. in php but instead
$ItemDescription['EN'] and $ItemDescription['DE'] etc.
then you can easily access them as $ItemDescription.$cLANG in smarty. |
|
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
|