脚本宝典收集整理的这篇文章主要介绍了php – 如何在Zend Framework中编写内部样式表?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<head> <style tyPE="text/css" media="all"> body{ background: #FFFFFF; } </style> </head>
我知道我可以使用$this-> view-> headLink() – > appendStylesheet(‘style.css’);写一个外部样式表.
但是我找不到编写内部样式表的方法.有任何想法吗?
HeadStyle助手的API与所有Head *视图助手一致,并且可以这样工作(以下假设您在视图中):
// Putting styles in order: // These methods assume the a string argument containing the style rules. // place at a particular offset: $this->headStyle()->offsetSetStyle(100,$customStyles); // place at end: $this->headStyle()->appendStyle($finalStyles); // place at beginning $this->headStyle()->PRependStyle($FirstStyles); // Or capturing a block of styles <?PHP $this->headStyle()->captureStart() ?> body { background-color: <?PHP echo $this->bgColor ?>; } <?PHP $this->headStyle()->captureEnd() ?>
请注意,您不包含< style>任何此输入中的标记.这是由助手本身产生的.
然后,在您的布局中,只需回显您希望其输出的帮助器:
<head> <?PHP echo $this->headLink() ?> <?PHP echo $this->headStyle() ?> </head>
以上是脚本宝典为你收集整理的php – 如何在Zend Framework中编写内部样式表?全部内容,希望文章能够帮你解决php – 如何在Zend Framework中编写内部样式表?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。