Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zend view: bootstrap(view) or bootstrap(layout)

These are 2 different implementations for an _init function in the bootstrap related to bootstrapping the view.

One gets at the view right away: bootstrap('view') then gets it as a resource

$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');

The other one takes a longer route through the layout bootstrap('layout')

$this->bootstrap('layout');        
$layout = $this->getResource('layout');
$view = $layout->getView();
$view->doctype('XHTML1_STRICT');

I don't want to judge the longer code as inefficient just because it's longer. Is there something it adds by going through the layout first instead of hitting the view right away?

like image 455
jblue Avatar asked Oct 11 '10 12:10

jblue


1 Answers

The short answer is no, not really.

With Zend Application the $view referenced in either way is the same object. As the layout and view are inherently related you can retrieve the view from the layout.

For your own sanity, the first one is more concise and quicker to comprehend.

like image 153
David Snabel-Caunt Avatar answered Nov 12 '22 06:11

David Snabel-Caunt