你在找什么叫做HeadStyle
查看帮手。其手册文档可以在here找到。
的HeadStyle
助手的API是将所有的Head*
视图助手保持一致,这样的工作(以下假设你是在一个viewscript):
// 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>
标签这个输入。这是由助手本身产生的。 然后,在你的布局,只需echo
助手,你想它的输出:
<head>
<?php echo $this->headLink() ?>
<?php echo $this->headStyle() ?>
</head>
请澄清你所说的“内部样式表”的意思。 – hobodave 2009-07-24 02:41:21
编辑的问题,以澄清内部样式表 – Marcel 2009-07-24 02:47:27