Zend Framework: Zend View Action Helpers


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.