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

Urgent Help needed: multi dimensional array

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


Joined: 04 Aug 2003
Posts: 5

PostPosted: Mon Aug 04, 2003 10:35 am    Post subject: Urgent Help needed: multi dimensional array Reply with quote

I have created array like

//push into one array
xaWhois[] = array("registrant" => $xaRegistrant,"admin" => $xaAdmin, "technical" => $xaTechnical,"status" => $xaStatus, "nameservers" => $xaNameservers);

I want to show all values with key in smarty template page. Each array contains different key and values.

Is there any simple way to access direct value of each array.

Help needed urgently


Last edited by gaurav on Wed May 05, 2010 10:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Mon Aug 04, 2003 12:07 pm    Post subject: Reply with quote

see http://smarty.php.net/manual/en/language.function.foreach.php "Example 7-5. foreach key"
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gaurav
Smarty Rookie


Joined: 04 Aug 2003
Posts: 5

PostPosted: Mon Aug 04, 2003 12:31 pm    Post subject: still not Reply with quote

Here $xaRegistrant, $xaAdmin are arrays with different index,values and each have different number of elements.
so how to parse them.


Last edited by gaurav on Wed May 05, 2010 10:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Mon Aug 04, 2003 1:20 pm    Post subject: Reply with quote

did you read the example on the link i posted? each $contact is an array with different keys and values, you can adopt this one-to-one to your problem. your example looks like a three-dimensional array so you have to extrapolate it to a three nested {foreach}s maybe but it works the same.

Code:

{foreach from=$xaWhois key=i item=who}
  {foreach from=$who key=what item=array}
    {foreach from=$array key=name item=value}
value {$xawhois.$i.$what.$name} is the same as {$value}
    {/foreach}
  {/foreach}
{/foreach}


HTH
Back to top
View user's profile Send private message Send e-mail 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 -> 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