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 array lookup in template

 
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
commando
Smarty Rookie


Joined: 10 Aug 2004
Posts: 7

PostPosted: Tue Aug 10, 2004 12:06 pm    Post subject: smarty array lookup in template Reply with quote

This is probably a very simple question, but I can't seem to crack it by myself Sad

I have an array that I want to display a single value out of in my tpl file. In php I would use:

$str = $messages['key'];

But if I put it in my tpl file I get a syntax error

<input type="text" name="name" value="{$message['key']}" />

Can anyone help? Many thanks for any suggestions.
Back to top
View user's profile Send private message Visit poster's website
sage
Smarty Rookie


Joined: 09 May 2004
Posts: 20
Location: London, UK

PostPosted: Tue Aug 10, 2004 12:51 pm    Post subject: Reply with quote

You want the . notation:

$array['name'] -> {$array.name}

Its on the sticky:
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=134
Back to top
View user's profile Send private message
commando
Smarty Rookie


Joined: 10 Aug 2004
Posts: 7

PostPosted: Tue Aug 10, 2004 7:38 pm    Post subject: Reply with quote

I knew it'd be something trivial like that, thanks sage! Very Happy

Any thoughts on this design pattern? I posted to the wrong forum Sad
Back to top
View user's profile Send private message Visit poster's website
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