GGshow reloaded GGshow reloaded

July 4, 2012

Zend Framework – View

To get the view object

  1. witin view script
    $view = $this;
  2. within action controller
    $view = $this->view;
  3. within bootstrap
    $this->bootstrap(‘view’);
    $view = $this->getResource(‘view’);
  4. within resource plugin
    $this->getBootstrap()->bootstrap('view');
    $view = $this->getBootstrap()->getResource('view');
Filed under: PHP,Web,Zend Framework — Tags: , , , , — GG @ 2:30 pm

Zend Framework – View Helper – Layout

To get layout object

  • within view script
    $layout = $this->layout()
  • within action controller
    $layout = $this->_helper->layout()
    $layout = $this->_helper->getHelper(‘Layout’)->getLayoutInstance()
  • within bootstrap
    $layout = $bootstrap->getResource(‘Layout’);
  • elsewhere
    $layout = Zend_Layout::getMvcInstance();

To assign variable to layout object

$layout->var = ‘value’;
$layout->assign(‘var’, ‘value’);

To enable or disable layout

$layout->enableLayout();
$layout->disableLayout();

To enable or disable layout using CLI

zf enable layout
zf disable layout
Filed under: PHP,Web,Zend Framework — Tags: , , , , , — GG @ 2:27 pm

© 2019 GGSHOW | Powered by WordPress