« Return to Thread: View Partial from another action

View Partial from another action

by Marko Korhonen :: Rate this Message:

Reply to Author | View in Thread

I wanted to render some part of the page from some other action: {module/controller/action/params}.

So I made following in my action:

$link = 'http://ww.mydomain.com/module/controller/action/param1/value';

$client = new Zend_Http_Client($link);
$response = $client->request();

// Initial content for my Ajax-driven partial in this view
$this->view->partial_content_to_my_page = $response->getBody();

I use that link as a Ajax source but I wanted to render initial view without Ajax. Only when this partial
is updated by some user action, I will update it via Ajax.


So my question is:

Is this Zend_Http_Client usage in this case ok? What are the pros and cons in this approach?
Does it take too much resources or something? Is it safe?
Or can I do it some other way? Should I make some action helper which runs selected action and
returns its rendered view to me?



br, Marko

 « Return to Thread: View Partial from another action