element in any view that needs to show a table for that model. I'm
trying to use the same element to display the table data in related
models as well. Is there any way to reformat the array for a related
model to match the format returned by the model's controller so I can
use the same foreach in the table?
Manufacturers returned by the vendors controller
($vendor['Manufacturer']):
Array (
[0] => Array (
[id] => 150
....
Manufacturers returned by the manufacturer controller (index),
($manufacturers):
Array (
[0] => Array (
[Manufacturer] => Array (
[id] => 150
...
Call from \vendors\view.ctp:
echo $this->renderElement('..\manufacturers
\table',array('manufacturers'=>$vendor['Manufacturer']));
Part of \manufacturers\table.ctp:
<?php
foreach ($manufacturers as $manufacturer){
echo $manufacturer['Manufacturer']['name'];
}
?>
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment