Zend framework Zend框架更改元标记
我在layout.phtml上有一些默认的元标记:Zend framework Zend框架更改元标记,zend-framework,meta-tags,Zend Framework,Meta Tags,我在layout.phtml上有一些默认的元标记: $this->headMeta() ->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8') ->appendName('description', 'test test test') ->appendName('keywords', 'test test test') ->appendName('robots', 'i
$this->headMeta()
->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8')
->appendName('description', 'test test test')
->appendName('keywords', 'test test test')
->appendName('robots', 'index, follow')
->appendName('language', 'bg')
->appendName('googlebot', 'index, follow, archive')
->appendName('tags', 'test test test');
如何在现有的from视图中添加更多关键字和说明,我尝试以下方法(/views/scripts/index/news.phtml:
echo $this->headMeta()
->appendName('description', 'new desc')
->appendName('keywords', 'new keys');
但是不起作用。Zend创建两个描述和两个关键字标签
我想向现有的.Exp添加新的关键字和说明。如果在layout.phtml中生成:
$this->headMeta()
->appendName('keywords', 'music, song, mp3')
在/views/scripts/index/news.phtml中,我想添加新的关键字,以添加到layout.phtml中已有的关键字。在视图中,而不是
appendName
方法使用setName
替换现有关键字或追加关键字
$this->headMeta()
->setName('description', 'new desc')
->setName('keywords', 'new keys');
echo $this->headMeta();
不要在视图脚本中回显headMeta()帮助程序-这就是创建副本的原因。只需调用它即可:
<?php
$this->headMeta()
->appendName('description', 'new desc')
->appendName('keywords', 'new keys');
?>
输出两个描述标签和两个关键字标签