Option 2. is fine for simple stuff, i.e. grab a bunch of data from the database and render it, but if there is any complexity to the logic, then you end up loading your helpers with application logic, which in a pure MVC world belongs in a controller or component. So in that case, requestAction would be the purest approach but suffers the overhead of re-initializing the environment each time. Ideally, there would be some middle ground approach, which currently you have to roll yourself, by instantiating a new controller and calling the appropriate method yourself.
Mark On Saturday, August 11, 2012 2:33:33 AM UTC-4, Sanjeev Divekar wrote: > > Hello, > > What is the best practice to display data e.g. list of products, events, > news in layout? > > 1. Element - which requires to call requestAction() and also calls > beforeFilter from AppController each time > 2. Helper - need to use Model class in helper > > Regards, > -- 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]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
