Posted By

jiewmeng on 07/23/10


Tagged

zend-framework


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

osirisinternet
postNuKe
piotrlewandowski


Zend Framework: Zend View Action Helpers


 / Published in: PHP
 

Zend View Action Helpers allows you to include output from another controller action into the current output.

  1. // IndexController.php
  2. public function widgetenabledoutputAction() {
  3. $html = "<ul>";
  4. for ($i = 1; $i <= 5; $i++) {
  5. echo "<li>Item $i</li>";
  6. }
  7. $html .= "</ul>";
  8. $this->view->html = $html;
  9. }
  10.  
  11. // index action view script (index.phtml), notice we are not calling widgetenabledoutputAction but can get output from it
  12. echo $this->action(
  13. $action = "widgetenabledoutput",
  14. $controller = "index",
  15. $module = null,
  16. "itemsPerPage" => 2 // can pass params as array
  17. )
  18. );

Report this snippet  

You need to login to post a comment.