0
votes

I am new to zend framework. I found code in bootstrap file as below.

 protected function _initDoctype()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('XHTML1_STRICT');
    }

can anyone explain me what "$this->bootstrap('view');" this mean?

3

3 Answers

4
votes

From the same page where your snippet comes:

Now that we have a view, let's flesh out our _initDoctype() method. In it, we will first ensure the View resource has run, fetch the view object, and then configure it.

3
votes

It sets up the view resource so that you can access it. Without it the following line would not return anything to put in the $view variable and you'd get the error:

Fatal error: Call to a member function doctype() on a non-object.
1
votes

It's pretty straightforward, it literally bootstraps the View object.
Bootstraping is a step where you set up (configure and instantiate) your object, resolve dependencies, etc.
It is done because the View Object must be set before to be able to set a Doctype.