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.
精彩评论