Why don't you authenticate the user in the AppController if the user is a 
user, then load the appropriate Model, get the values you need through the 
Model and set it to the view.

This can all be done within the beforeFilter of your AppController.


On Wednesday, January 14, 2015 at 3:10:39 AM UTC+2, Ben Merton wrote:
>
> I'm wanting to make certain variables (counts of various records) to be 
> used on most views in my app. Currently I'm both loading each relevant 
> model and doing the count operation to create the variable I want to pass 
> to my views within the appcontroller as it will then be available to every 
> view. Is this the best way to do it or is there a better way to do it that 
> keeps the code out of the appcontroller.
>
> For context, I'm showing user statistics on each page of the users part of 
> the site.
>
> Thanks!
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Reply via email to