views:

36

answers:

2

i am just reading on zend view action helpers on zend framework docs. so i created an index action

// index.phtml
... 
echo $this->action(
  $action = "widgetenabledoutput",
  $controller = "index",
  $module = null,
  array(
    "noLayout" => true,
    "itemsPerPage" => 15
  )
);

// index controller (IndexController.php)
public function widgetenabledoutputAction() {
  $noLayout = $this->getRequest()->getParam("noLayout");
  $itemsPerPage = $this->getRequest()->getParam("itemsPerPage");

  if ($noLayout) { // i made this such that this page/action can be displayed with layout and without. 
    $this->_helper->layout->disableLayout();
  }
  $html = "<ul>";
  for ($i = 1; $i <= $itemsPerPage; $i++) {
    echo "<li>Item $i</li>";
  }
  $html .= "</ul>";
  $this->view->html = $html;     
}

the error i got was that in the index action, index.phtml, my intention was to get the output (list) of widgetenabledoutputAction not the layout of widgetenabledoutputAction but i want the layout of indexAction does it make sense? am i doing something wrong? or must i make a delicated action for something i want to use a action helper from?

A: 

If you just want to use a different view use

$this->_helper->viewRenderer('index');

You don't need to call another action to use the same view

Ashley
this i believe will render the index action? not sure, but what i was intending to do, or testing out is action helpers allowing me to add content from whats generated from another view into my current output
jiewmeng
A: 

i have found out that using a zend view action helper is smart enuf and automatically disables layout for that view. so it only gives the output from that action view script and not the layout. what i did seem like disable layout for the request not what i wanted.

jiewmeng