zend framework 2 list modules in layout -


i want have plug-in system (like wordpress ) , how can list admin controller in layout.phtml ?

the list of modules if available in module manager (zend\modulemanager\modulemanager). can module manager via service locator. example in controller:

class mycontroller extends abstractactioncontroller {     public function indexaction()     {         $manager = $this->getservicelocator()->get('modulemanager');         $modules = $manager->getloadedmodules();     } } 

the controllers have access layout (and parameters) via layout controller plugin.

$this->layout()->modules = $modules; 

an alternative create view helper. in view helper, module manager , return list of modules.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -