开发者

headMeta() in zend_view returns nothing, what am I doing wrong?

开发者 https://www.devze.com 2023-02-26 20:38 出处:网络
I\'m using Pimcore with the Zend Framework. In my header view, I output this: <?php echo $this->headMeta(); ?>

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();
    ?>
//...
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号