Override header_required.php not working
Permalink
I'm currently learning to use Concrete5. I have Concrete5 set up and working on a local LAMP server, and I've successfully built/edited a basic theme.
My next challenge was to try overriding header_required.php, because I wanted to customise the page title.
I've copied the file up to my elements/ dir, but Concrete5 is ignoring this copy and still using the concrete/elements/ version of the file.
I know this is supposed to be really straightforward, so what am I missing? I've read every thread on the forum and every page of the documentation that I can find, and this is just supposed to work, so why isn't it?
I realise I'm asking you to do the impossible, but any pointers that might get me going in the right direction would be REALLY appreciated.
Thank you :)
Nikki
My next challenge was to try overriding header_required.php, because I wanted to customise the page title.
I've copied the file up to my elements/ dir, but Concrete5 is ignoring this copy and still using the concrete/elements/ version of the file.
I know this is supposed to be really straightforward, so what am I missing? I've read every thread on the forum and every page of the documentation that I can find, and this is just supposed to work, so why isn't it?
I realise I'm asking you to do the impossible, but any pointers that might get me going in the right direction would be REALLY appreciated.
Thank you :)
Nikki
Hi adajad,
Thanks for your reply. I should have made myself clearer.
I do want to edit header_required.php and I do know my way around PHP very well.
What I want to do is change the code for the page title so that it displays the site name AND the meta title name. At the moment, if you add a meta title to a page, the page title loses the site name.
I have changed the code
to
so that the title display is consistent, without having to type the site name into the meta name field for every page.
What I still don't know is why my override is not working.
Thanks,
Nikki
Thanks for your reply. I should have made myself clearer.
I do want to edit header_required.php and I do know my way around PHP very well.
What I want to do is change the code for the page title so that it displays the site name AND the meta title name. At the moment, if you add a meta title to a page, the page title loses the site name.
I have changed the code
if ($akt) { $pageTitle = $akt; ?><title><?php echo htmlspecialchars($akt, ENT_COMPAT, APP_CHARSET)?></title> <?php } else { $pageTitle = htmlspecialchars($pageTitle, ENT_COMPAT, APP_CHARSET); ?><title><?php echo sprintf(PAGE_TITLE_FORMAT, SITE, $pageTitle)?></title> <?php }
to
if ($akt) { $pageTitle = htmlspecialchars($akt, ENT_COMPAT, APP_CHARSET); ?><title><?php echo sprintf(PAGE_TITLE_FORMAT, SITE, $pageTitle)?></title> <?php } else { $pageTitle = htmlspecialchars($pageTitle, ENT_COMPAT, APP_CHARSET); ?><title><?php echo sprintf(PAGE_TITLE_FORMAT, SITE, $pageTitle)?></title> <?php }
so that the title display is consistent, without having to type the site name into the meta name field for every page.
What I still don't know is why my override is not working.
Thanks,
Nikki
Try renaming it to 'my_header_required.php' and call that file instead.
Also, make sure you have turned off Overrides Cache (in 'yourdomain.com/index.php/dashboard/system/optimization/cache/) when developing.
<?php Loader::element('my_header_required'); ?>
Also, make sure you have turned off Overrides Cache (in 'yourdomain.com/index.php/dashboard/system/optimization/cache/) when developing.
Thank you!
The override cache was still on. I'd switched off the basic cache, but overlooked the override cache at the time.
All working correctly now :)
The override cache was still on. I'd switched off the basic cache, but overlooked the override cache at the time.
All working correctly now :)
To update the page title you just need to edit the properties for the page in question - either from the page itself or from dashboard/sitemap.