开发者

How can I check if headTitle is already used in Zend Framework?

How to check if headTitle is already used?

To avoid appending or overwriting existing title, which was set earlier in parent views/layout.

Thanks ;)

Update

Exam开发者_开发知识库ple:

$this->headTitle('First title'); // index.phtml
$this->headTitle('Second title'); // some-nested-tpl.phtml

Check whether First title is set and assign Second if not.


You can simply check the content of headTitle and if it's the default then write something else like:

if($this->headTitle() == '<title></title>') {
  $this->headTitle('foo')
}

Or write yourself a view-helper to safe yourself some writing time and have a function like

$this->headTitleIfEmpty('foo');

which does the above, so you have a short tag in your templates.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜