Thanks AD7six, I think I'm understanding.
Although I'm not sure of the best route for my site now.
When i request action im doing it to a function like the following,
toget an array (no html):
in the home page controller:
$this->set("listings",$this->requestAction("/listings/tonight"));
and that function looks like:
function tonight(){
$this->Listing->unbindModel(array('hasMany' =>
array('Image')));...
...
case 'Club':
$conditions = "(ltype.name = 'Club') AND (listing.date
>= '$today')
AND (listing.date < '$nW')";
$fields = array('Ltype.name', 'Listing.name', 'Listing.date',
'Club.name', 'Venue.name');
break;
default:
$conditions = "(listing.date >= '$today') AND
(listing.date <
'$nW')";
$fields = array('Ltype.name', 'Listing.name', 'Listing.date',
'Club.name', 'Venue.name');
break;
}
$order = "Listing.date ASC";
return $this->Listing->findAll($conditions, $fields, $order, 10,
null, 0);
}
I've just tried putting this into the home page controller (using
multiple models) and it works fine. But this way (above) I can reuse
the code rather than have it repeated on each page. It also lets me use
more logic to refine the array.
Would a component do this better?
Would
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---