My website has a login system which I wrote in PHP and has some sections managed by couchCMS. Every webpage of my website has this code:
Pages managed by couchCMS are not an exception.
Then goes this line:
header.php includes tags persistent throughout all pages. It shows user's avatar and some other info, detects user languages for gettext.
Also header.php has this line:
(<?= is a shorthand for <?PHP echo)
If I place couch/cms.php above header.php, the header contents will be cached by couchCMS and will not be personalized. I have got separate login system specifically and thoroughly designed for the website, and I have no intention to have couch managed logins for all of my users.
So I created a template for couchCMS-enabled zone of the website and everything was fine and dandy until I realized, that I have to put <title> tag into the <body> tag, which might break SEO.
The reason behind that is because couchCMS does its thing after all PHP is executed and my <head> tag belongs to header.php, so modifying $title does nothing.
So, now I have this line inside my <body> tag in couchCMS-enabled pages:
Of course I can use javascript to move <title> from <body> to <head>, but I think it's beyond bad idea.
So the question is, how do I move the <title> tag into <head>, while having header.php not being cached by couchCMS?
UPDATE:
Since I'm using html5 and don't care about IE6-8, I've removed <head> and <body> tags completely and the title tag is generated like this:
If I move this code AFTER a <div> which shows user's avatar and some other info, my page still does not validate, because I suppose the <title> tag is expected to be set before any content set for output.
Please tell me that something still can be done without modifying CouchCMS's caching subsystem.
- Code: Select all
<?php include "header.php" ?>
Pages managed by couchCMS are not an exception.
Then goes this line:
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
header.php includes tags persistent throughout all pages. It shows user's avatar and some other info, detects user languages for gettext.
Also header.php has this line:
- Code: Select all
<?PHP if (isset($title)) { ?>
<title><?= _($title) ?> - Plan Z Online</title>
<?PHP } ?>
(<?= is a shorthand for <?PHP echo)
If I place couch/cms.php above header.php, the header contents will be cached by couchCMS and will not be personalized. I have got separate login system specifically and thoroughly designed for the website, and I have no intention to have couch managed logins for all of my users.
So I created a template for couchCMS-enabled zone of the website and everything was fine and dandy until I realized, that I have to put <title> tag into the <body> tag, which might break SEO.
The reason behind that is because couchCMS does its thing after all PHP is executed and my <head> tag belongs to header.php, so modifying $title does nothing.
So, now I have this line inside my <body> tag in couchCMS-enabled pages:
- Code: Select all
<title><cms:show k_page_title /></title>
Of course I can use javascript to move <title> from <body> to <head>, but I think it's beyond bad idea.
So the question is, how do I move the <title> tag into <head>, while having header.php not being cached by couchCMS?
UPDATE:
Since I'm using html5 and don't care about IE6-8, I've removed <head> and <body> tags completely and the title tag is generated like this:
- Code: Select all
<?PHP if (isset($title)) { ?>
<title><?= _($title) ?> - Plan Z Online</title>
<?PHP } else { ?>
<?PHP require_once( 'couch/cms.php' ); ?>
<title><cms:show k_page_title /> - <cms:show k_template_title /> - Plan Z Online</title>
<?PHP } ?>
If I move this code AFTER a <div> which shows user's avatar and some other info, my page still does not validate, because I suppose the <title> tag is expected to be set before any content set for output.
Please tell me that something still can be done without modifying CouchCMS's caching subsystem.