This code snippet runs perfectly and on every page. I am trying to set the $pageTitle dynamically. This means that I am trying to set it for every page differently. I have set inside the UsersController.php $this->set('pageTitle', 'Nebojsa'); In index method. But when I go to the url /users/index , this page title stays 'test'. I have also tried to assign the value inside the Template/Users/index.ctp <?= $this->assign('pageTitle', __('Users')); ?> But it won't work. What am I doing wrong ? Could you maybe point me in the right direction, where should I look ?
<div id="header"> <div class="header-title"> <h2><?php echo (isset($pageTitle)) ? $pageTitle : 'Test'?></h2> </div>