|
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 |
yag Smarty n00b
Joined: 22 Aug 2004 Posts: 1
|
Posted: Sun Aug 22, 2004 4:40 pm Post subject: Multidimensional arrays - once again |
|
|
Hello everyone,
I've searched the forums and found some similar problems with solutions, and I've tried to work it out, but it just not going to happen I guess. Here is my problem. I pass an array like the one below to smarty:
Code: |
Array
(
[2] => Array
(
[scores] => Scores
[add] => Enter_scores
[check] => Check_scores
)
)
Array
(
[8] => Array
(
[players] => Players
[add] => Add_players
[edit] => Edit_players_data
[remove] => Remove_player
)
)
Array
(
[9] => Array
(
[teams] => Teams
[add] => Add_teams
[edit] => Edit_teams_data
[remove] => Remove_teams
)
) |
And I want to create something like this (some kind of menu):
Code: |
* Scores
---- Enter_scores
---- Check_scores
* Players
---- Add
---- Edit
---- Remove
* Teams
---- Add
---- Edit
---- Remove
|
This array is created dynamically, by taking the data out of the MySQL database.
Can anyone help me? Maybe I need to create this array in some other way to get it working? |
|
Back to top |
|
dthought Smarty Regular
Joined: 21 Apr 2003 Posts: 55 Location: Melbourne, Australia
|
Posted: Wed Aug 25, 2004 7:12 am Post subject: |
|
|
You can get around that with a foreach. Because your keys do not start with 0 and are not necessarily sequential, foreach is your answer |
|
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
|