But this only works, as mentioned, with a template modification. I want this functionality to be template-independent.... so I need the plugin to output what I want using the normal index.tpl title element of <title>{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}</title>. In other words, I need to set $head_title to my extended field/variable of meta_head_title and set $head_subtitle to blank..... and ONLY on single entry pages.
Many thanks to Judebert and Grischa for helping me to get this far, but I think we might have collectively run into a wall and I now need further assistance.
The plugin currently emits to the frontend, and determines a single entry output, by the following:
Code: Select all
case 'frontend_header':
if ($serendipity['GET']['id'] && isset($GLOBALS['entry'][0]['body'])) {
// Only emit in Single Entry ModeCode: Select all
if (!empty($GLOBALS['entry'][0]['properties']['meta_head_title'])) {
$meta_head_title = $GLOBALS['entry'][0]['properties']['meta_head_title'];
}Code: Select all
$serendipity['head_title'] = htmlspecialchars($meta_head_title);
$serendipity['head_subtitle'] = '';So, I have one event hook/case that will allow me to set $meta_head_title, and a different one that will allow me to manipulate $serendipity['head_title'], but NEITHER will do BOTH!
This is how I have defined $meta_head_title:
Code: Select all
function introspect(&$propbag) {
global $serendipity;
( this is not code - other stuff removed to shorten post......)
$this->supported_properties = array('meta_description', 'meta_keywords', 'meta_head_title');- I have an extended entry value for meta_head_title
I am successfully presenting this to the backend and saving it. Not a problem
For single entry - and only single entry - pages, I need to set the <title> element to this value so no index.tpl smarty condition is necessary.