views:

55

answers:

1

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?

+3  A: 

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.

David Caunt