Renderring a view of a different Controller is the same as rendering a
view of the same controller. (Using AJAX helper).

[EMAIL PROTECTED], my first thought when I see your approach is: it violates 
MVC.
However, upon further look I think it actually make sense since there
is no use in duplicating view code, UsersController does what it knows
best: controlling users. Thus, forcing MVC => retrieving user list
from User model then display it is actually violating encapsulation in
OOP.

On Feb 13, 4:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I see.  I wonder if requestAction could help you there?
> The cake manual page seems to infer that it might do what you want.
>
> Here's an excerpt fromhttp://manual.cakephp.org/chapter/controllers
>
> If you have an often used element in your application that is not
> static, you might want to use requestAction() to inject it into your
> views. Let's say that rather than just passing the data from
> UsersController::getUserList, we actually wanted to render that
> action's view (which might consist of a table), inside another
> controller. This saves us from duplicating view code.
> class ProgramsController extends AppController
> {
>     function viewAll()
>     {
>         $this->set('userTable', $this->requestAction('/users/
> getUserList', array('return')));
>
>         // Now, we can echo out $userTable in this action's view to
>         // see the rendered view that is also available at /users/
> getUserList.
>     }
>
> }
>
> Please note that actions called using requestAction() are rendered
> using an empty layout - this way you don't have to worry about layouts
> getting rendered inside of layouts.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to