$ this-> headTitle () does not work

I have in my config.ini the headers of my pages In my Bootstrap.php I have

$title  = $config->title;
Zend_Registry::set('title',$title);
$view->headTitle($title);

In mine layout.phtmlI have:

echo $this->headTitle();

This does not work. The title is empty. What should I do?

+3
source share
3 answers

Will you return the performance in bootstrap after you are done with it?

return $view;
+2
source

As lznogood pointed out, are you setting the view in the boostrap class correctly?

It should look something like this:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    function _initView()
    {
        $view = new Zend_View($this->getOptions());
        ...
        $view->headTitle($title);

        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
            'ViewRenderer'
        );
        $viewRenderer->setView($view);

        return $view;
    }    // Added missing '}' brace
}

Another example can be found here .

+2
source

Don't you forget to read it from the registry? You can do it with

Zend_Registry::get('title');
0
source

Source: https://habr.com/ru/post/1751277/


All Articles