// Controller
$parks = $this->Skatepark->find('list', array(
'fields' => array(
'Skatepark.id', // Key path
'Skatepark.city', // Value path
'Skatepark.state' // Group path
),
'order' => 'Skatepark.city ASC, Skatepark.state ASC'
);
$this->set(compact('parks'));
// parks looks like this
// array('Florida' => array(23 => 'Orlando', 17 => 'Daytona'), 'Ohio'
=> [...])
// View
echo '<ul>';
foreach ($parks as $state => $parksList) {
echo '<li>' ;
echo $state;
echo '<ul>';
foreach ($parksList as $id => $city) {
echo '<li>' . $html->link($city, array('controller' =>
'skateparks', 'action' => 'view', $id)) . '</li>';
}
echo '</ul>';
echo '</li>';
}
echo '</ul>';
On May 12, 11:46 am, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> look at self relating the table by using a field named parent_id if your
> baking cake will recognise that the relationship is a child/parent
>
> id | parent id | name | address | city | state ...etc
>
> 2008/5/12 Kyle Decot <[EMAIL PROTECTED]>:
>
>
>
> > They're not stored in separate tables. They're stored in my skateparks
> > table which has:
>
> > id | name | address | city | state ...etc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---