Say for example in mydefaultlayout.phtml i have an array declared in this way
$pages['words'] = array( 'APPLE', 'BALL', 'CAT', 'DOG', 'HELL', 'INK', 'PINK'); $pages['letters'] = array( 'A', 'B', 'C', 'D', 'H', 'I', 'K');
Mydefaultlayout.phtml has been my default layout in the entire application so it is available to every controller .So How do I access this elements $pages['words'] and $pages['letters'] in my controller.
How can i assign them to the view from the controller.
Class MyController extends Zend_controller_Action{
public function indexAction(){
if($_POST['page']=='ABC'){ //How do i assign this $pages['words'] and $pages['letters'] to the view
$view->myarray = $pages['words'];
$view->myarray = $pages['letters'];
}
}
}
One solution i have in mind is again redefine the $pages['words'] and $pages['letters'] in the controller and assign it to the view which is the repeatative code .How can i access the $pages['words'] and $pages['letters'] in the controller or view directly