Cristof's suggestion works as well, and will keep the code clean as
well.
As an alternative to your question, you can always cache queries in
your Categories model, so that the overhead in getting the categories
will be negligible.
function getCategories() {
$categories =
Cache::read('categories');
if (empty($categories))
{
$categories = $this->find('all');
Cache::write('categories', $categories, '1 hour');
}
return $categories;
}
On Oct 10, 4:24 pm, "Christof Damian" <[EMAIL PROTECTED]> wrote:
> 2008/10/10 MikeB <[EMAIL PROTECTED]>:
>
>
>
> > Good point. I'm all for following best-practices. However, what if,
> > for examples sake, I didn't need to include the navigation in every
> > page? I would be wasting time querying/compiling a list of categories
> > that wouldn't be accessed in the view.
>
> Write a CategoryController class and make the classes which need the
> categories child classes of this one. There is no need to have it in
> AppController.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---