headMeta() in zend_view returns nothing, what am I doing wrong?
I'm using Pimcore with the Zend Framework. In my header view, I output this:
<?php echo $this->headMeta(); ?>
The output is blank. Instead I've changed it to this:
<meta name="description" content="<?php echo $this->document->description ?>" />
<meta name="keywords" content="<?php echo $this->document->keywords ?>" />
That works fine. The issue here is that I want to use zend correctly and I feel that this is probably not the most ideal approach.
Can anyo开发者_JS百科ne coach me on the correct way of performing this?
Thank you!
In your Boostrap.php
file you need to init the head
with values like this:
$view->headMeta()->appendHttpEquiv('Content-type', 'text/html; charset=UTF-8')
->appendName('description', 'mySite');
$view->headTitle()->setSeparator ('-')->headTitle('myPage');
$view->doctype('HTML4_STRICT');
This code belongs in the _initViewHelpers
function. Then you can call it in the <head>
:
<?php
echo $this->doctype ();
?>
<html>
<head>
<?php
echo $this->headMeta();
echo $this->headTitle();
?>
//...
精彩评论