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

Complax Arrays & Templates ?

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
garryhs
Smarty Rookie


Joined: 20 Jun 2004
Posts: 12
Location: Australia

PostPosted: Sun Jun 20, 2004 12:04 pm    Post subject: Complax Arrays & Templates ? Reply with quote

Hi all,

Can anybody help me.

Say I have an array in PHP like,

$colour["blue"]["dark"] = "bd";

Then I assign it so it can be used in my template...

$smarty->assign("colour", $colour);

Now, my question, in my template I have the values stored which could be used as a fast lookup...

{$colour_name}
{$colour_shade}

Can I display the value stored using {$colour.$colour_name.$colour_shade}

I am running smarty 2.5.0, unable to upgrade at this time.

I really do not want to do it like this...

{$colour.blue.dark}

Any Help would be appreciated...
_________________
Thanks,

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


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

PostPosted: Sun Jun 20, 2004 7:13 pm    Post subject: Reply with quote

I'll give you the link to a post I made in another thread recently that is of consequence to your situation.

http://www.phpinsider.com/smarty-forum/viewtopic.php?p=10448&highlight=#10448

Basically:

$arr[$key1].$key2 or even $arr[$key1][$key2]
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 -> Tips and Tricks 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