[eluser]meigwilym[/eluser]
Hi,
I extended the class so I could write meta data like this:
Code:
$this->template->add_meta('description', 'An example of a page description.');
so the meta tag would be written to the template via
I added this method to the class:
Code:
/**
* Dynamically include meta tags in the template
*
* @param string $key meta name
* @param string $value meta content
* @return bool
*/
function add_meta($key, $val)
{
$success = FALSE;
$meta = '<meta name="'.$key.'" content="'.$val.'" />';
if(!in_array($meta, $this->meta))
{
$this->meta[] = $meta;
$this->write('_meta', $meta);
$success = TRUE;
}
return $success;
}
and these other changes:
Code:
// added this to the class properties
var $regions = array(
'_scripts' => array(),
'_styles' => array(),
'_meta' => array(),
);
var $meta = array();
// changed the array in template->set_regions() to
$this->regions = array(
'_scripts' => array(),
'_styles' => array(),
'_meta' => array(),
);
I haven't trawled properly through the class so I'm not sure if all the above code is necessary.
If you have suggestions to improve this code please let me know.
Mei