We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Title is not appearing

Hi, I have a problem about my project the title is not appearing

this one is in my controllerbase

use Phalcon\Mvc\Controller,
    Phalcon\Tag as Tag,
    Phalcon\Mvc\Dispatcher;

class ControllerBase extends Controller
{
    public function initialize(){
        Tag::prependTitle('PhalconStore | ');
    }
}

this is my company controller

use Phalcon\Mvc\Controller,
    Phalcon\Tag as Tag,
    Phalcon\Mvc\Dispatcher;

class CompanyController extends ControllerBase
{
    public function initatize(){
        parent::initialize();
        Phalcon\Tag::setTitle('Company');
        $this->view->setLayout('company');
    }

    public function indexAction()
    {

    }
}

my title should look like this Phalconstore | Company but it's not doing it.



98.9k
Accepted
answer

You have to call parent::initialize after setTitle:

public function initatize(){        
        Phalcon\Tag::setTitle('Company');
        parent::initialize();
        $this->view->setLayout('company');
}

thanks a lot sir @Phalcon it works.