Sounds like you're not doing it the cake way. If you really really want to do that, your best bet is to use loadModel. To be honest, what you're doing doesn't really fit the cake, or MVC model particularly well, so if I were you I would look at elements as an alternative to all the requestActions.
If you stick to Cake's conventions based approach, your best bet is still to do the work in app_controller, or a component. Simon On Nov 2, 9:43 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > If I write that in the startup function of the component it will be > called for the every controller in a page (which is not good because I > use 'requestAction' a lot so startup will be called more than once). > What I was actually thinking is to create my own class and call the > initialization somewhere in bootstrap, but i don't know how to use a > model by itself in a custom class. > > On Nov 2, 2:43 pm, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > What you probably want to do is write a component and handle your > > logging in the startup function. > > > You probably also want to be using the component to inform the > > controller as to layout / views to use for the skinning. Depending on > > your controllers, there are all sorts of ways you could do this, > > ranging from $controller->layout = 'skin' in component startup to a > > beforeRender filter. > > > To get access to the db tables in your component, you'll have to use > > loadModel to grab instances for the logging and prefs etc. > > > Pages controller is something totally different. It is a simple > > controller to just display views from the /app/views/pages directory > > without the hastle of creating actions. Essentially it is for static > > content. However, it could be informed by your component to change the > > layout (skin) around static content and to log user progress if you > > add your component to AppController in /app/app_controller.php. > > > Hope that helps. > > > Simon > > > On Nov 2, 12:30 pm, Cristian Vrabie <[EMAIL PROTECTED]> wrote: > > > > hi everybody, > > > i'm new to phpcake organization model and i'm having some problems > > > integrating some classes. maybe you can give me a hand. > > > > i need a "visitor" class that will be responsible with tracking a site > > > 'visitor' (not a user), keep a track and use his settings (like language > > > and skin preferences) via cookies and similar stuff. the thing with this > > > is: i don't know if this should be a controller or a component. i would > > > say it's a controller because it hase it's own models (like log tables, > > > preferences table, etc), but then, it has no view and must be called > > > (initialized) on every page before everything else, and be accesible > > > from any other controller. > > > > what should i do? i saw a page_controller somewhere and i think i can > > > use that but i'm not sure how? > > > > what do you sugest. i'm sure this is a preaty common practice. what do > > > you use? > > > > thanks, > > > Cristian --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
