> From: [email protected]
> Color hasMany Product, Product belongsTo Color. I'm trying to return
> all the products in a specific color category...and display the
> color.name at the top of the page.
So if you retrieve the color instead, you should have all its associated
products.
In color_controller:
function products( $id )
{
$this-Color->id = $id ;
$this->set( 'data', $this->Color->read() ) ;
}
In view:
<h1><?php echo $data['Color']['name'] ; ?> Products</h1>
<table>...
<?php foreach ( $data['Product'] as $product )
{
?>
... Output data ...
<?php
}
?>
</table>
--
Regards,
Ryan Ginstrom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---