|
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 |
alexh Smarty Rookie
Joined: 19 Feb 2004 Posts: 10 Location: London
|
Posted: Tue Aug 03, 2004 9:40 am Post subject: Nested Loops? |
|
|
This is a problem I have been struggling with for some time and would really appreciate a response from someone.
I have 2 arrays. The second holds information relative to the first, and has multiple rows relative to each 1 row of the first array. What I am trying to achieve is that for each iteration of the first array (using section) I want to have a nested iteration of the second array but only for the same/one index. For example:
Code: |
$array1[] = array('company' => $company, 'address' => $address, 'tel' =>$tel);
$array2 = $employee[] = array('firstName' => $firstName, 'lastName' => $lastName); |
I have only recently started using both Arrays and Smarty and am stuck on 2 points:
Firstly, what is the correct PHP syntax to add multiple employees to $array2, so that $array2 has the same number of rows as $array1 and it is the inner Array that has multiple rows.
Secondly, how do I set up the loop in Smarty to output the company's details and all their employees within a nested loop. |
|
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
|