Support > Elxis 4.x/5.x DEV
Howto retrieve meta keywords
fgijsels:
finally found the following solution:
in C:\inetpub\wwwroot\templates\hygieia\index.php
...
elxisloader::loadFile('templates/hygieia/includes/hygieia.class.php');
$hygieia = new templateHygieia();
// display the document type before the html tag.
echo $eDoc->getDocType()."\n";
?>
<!-- Start html this way (elxis will append some attributes on the html tag) -->
<html <?php echo $eDoc->htmlAttributes(); ?>>
<head>
<?php $hygieia->getmetaKeywords($eDoc); ?>
...
</head>
...
</html>
in C:\inetpub\wwwroot\templates\hygieia\includes\hygieia.class.php
class templateHygieia {
/*********************/
/* GET META KEYWORDS */
/*********************/
public function getMetaKeywords($eDoc) {
$myReflectionClass = new ReflectionClass(get_class($eDoc));
$myProperty = $myReflectionClass->getProperty('keywords');
$myProperty->setAccessible(true);
$keywords = $myProperty->getValue($eDoc);
if (count($keywords) > 0) {
$str = eUTF::str_replace('"',"'", implode(', ', $keywords));
$html .= "\t".'<meta name="keywords" content="'.$str.'" />'."\n";
}
echo $html;
}
}
Navigation
[0] Message Index
[*] Previous page
Go to full version