php - Variable from Navigationcontroller to navigation.phtml -


i new zend2. question how can pass var or array navigation.phtml, succeeded layout. want controle navigationcontroller

what missing?!

navigationcontroller:

namespace front\controller;  use zend\mvc\controller\abstractactioncontroller; use zend\view\model\viewmodel;  class indexcontroller extends abstractactioncontroller {  function __construct() {         return $this->layout()->myvariable = 'navigation test';     } } 

navigation.phtml:

<?php print_r($this->layout()->myvariable); ?> 

module.config

'controllers' => array(     'invokables' => array(         'front\controller\index' => 'front\controller\indexcontroller',         'front\controller\pages' => 'front\controller\pagescontroller',         'front\controller\navigation' => 'front\controller\navigationcontroller'     ), ),       'template_map' => array(         'layout/layout'     => __dir__ . '/../view/layout/layout.phtml',         'meta'            => __dir__ . '/../view/layout/meta.phtml',         'navigation'            => __dir__ . '/../view/layout/navigation.phtml', 

you use controller wrong. i'm not willing teach basics, please refer the official manual , see section forms , actions zend\view quickstart

all in all, biggest suggestion can give you: don't use framework if you're not willing work through documentation...


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -