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

referencing array with variable

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


Joined: 05 Jun 2006
Posts: 18

PostPosted: Tue Sep 12, 2006 12:29 pm    Post subject: referencing array with variable Reply with quote

Hi,

I am sure this must have been answered but couldn't find it. so sorry if this is duplication.

I want to do this.

{$languagesArray.template.chooselanguage[$currentDocument->language]}
Where the language property of currentDocument is an integer.

but I can't get it to work.have tried back ticks and stuff.

What am I doing wrong?

Many Many Thanks to anyone who can help,

TW
_________________
We make a living by what we get.
We make a life by what we give.
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Tue Sep 12, 2006 12:44 pm    Post subject: Reply with quote

http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions#template-5
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TofuWarrior
Smarty Rookie


Joined: 05 Jun 2006
Posts: 18

PostPosted: Tue Sep 12, 2006 12:52 pm    Post subject: Reply with quote

Thanks messju,did the job a treat.

SOLUTION:
{assign var=key value=$currentDocument->language}
<h2>{$languagesArray.template.chooselanguage.$key}</h2>

TW
_________________
We make a living by what we get.
We make a life by what we give.
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 -> General 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