Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-07-2007, 12:24 PM
Junior Member
 
Join Date: Sep 2007
Posts: 1
Default How to include ControllerAction in a View Script?

Hello,

I'm stuck to this problem quite a while now. How to include a complete Controller Action and the associated view script into another view script?

controllers/TestController.php:
PHP Code:

class TestController extends Zend_Controller_Action
{
 [...]
 public function 
selectAction()
    {
         
$this->view->title "Yes.";
    } 
views/scripts/test/select.phtml:
PHP Code:

Does it work? <?php echo $this->title?><br>
views/scripts/index/index.phtml:
PHP Code:

This is the normal index output.<br>
And now the output from TestController.selectAction:
<?php 
  
how to include the TestController::selectAction output ?
?>
I don't want to include just the rendering of the view (which could be done via $this->view->render('Test/select.phtml') ) - but first the assignment via the TestController.selectAction.

The output should look like this (assumed above example is working):

HTML Code:
This is the normal index output.
And now the output from TestController.selectAction: Does it work? Yes.
Is this possible?

Regards,
Dennis
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-07-2007, 10:11 PM
Junior Member
 
Join Date: Jul 2007
Posts: 7
Default

The 'dirty' solution could be to do a http-request to /test/select in the index controller. Put the response in a variable ($this->view->selectOutput) and use this in your index.phtml.

That is wat I was thinking. It seems to be easy to do, but maybe not so 'nice'.

Snef
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-14-2007, 02:27 PM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default

Do a forum search for Zend_View_Enhanced. It contains a helper that lets you do what you are asking for.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:48 PM.