Thursday, March 25, 2010

Re: Multiple Recordsets in Same View

It depends on the situation. If the models are associated, it's easy
enough to do $this->Model->find(...) and $this->Model->OtherModel-
>find(...) in the same action. In your case, though, it looks like the
two models wouldn't necessarily be associated. So, you could look at
using requestAction(). But you need to understand that doing so
creates an entirely new request, meaning that all of "behind the
scenes" cake stuff is loaded again. To get around that, you'd cache
the output. Search google for "cakephp requestaction cache".

On Mar 25, 12:02 pm, Alper K. Tunç <alpe...@gmail.com> wrote:
> Hello all,
>
> I'm one of the latest fans of CakePHP. I met with the framework through a
> Google search for "PHP frameworks" and looking at the features (and the cute
> name of course) decided on CakePHP. I went through the blog tutorial and
> studied some stuff from web. Now I feel ready to shoot with my own
> application.
>
> I'm an old Microsoft ASP developer. So the "recordset" metaphor comes from
> past experience.
>
> Let's say I'm developing a web page where I will list some forum titles and
> some news. This means I need to access to both forums and news tables.
> But -as far as I understand- the CakePHP structure is like you create a
> model for your table, then you create a controller for your model and
> finally you create a view for your model and controller. How am I going to
> use two different recordsets (tables) in the same view?
>
> (I found some pages discussing using another model in a model and suggesting
> that it is not good practice.)
> Indeed my question what is the best practice to do this multible recordset
> access issue and what should be avoided explicitly?
>
> Regards,
> Alper K. Tunç

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: