开发者

Add comments to HEAD Zend Framework

Is there a view helper to add comments (not conditional comments) to the HEAD section of the page. I am using a layo开发者_StackOverflow中文版ut approach.


On a couple of the view helpers supplied with Zend Framework you can use captureStart() and captureEnd() to grab comments. Not what it is designed for, but it works.

eg (in a view script):

<?php $this->headScript()->captureStart(); ?>
<!--some comment-->
<?php $this->headScript()->captureEnd(); ?>

Then in your layout echo $this->headScript() in the head.

This is just proof of concept. Most of the head view helpers will throw an error if you try this. It only works with headScript and headStyle. Of the two I would use headStyle as good practice these days is to have the styles in the head and scripts in the footer. Ideally you can write your own view helper to do this specifically.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜