Closed netyum closed 11 years ago
What is the issue? Tried putting the code in controller, but no problem. Please describe the steps to reproduce the issue.
ok.qiang. chinese.
直接在controller的action中添加一行注册
public function actionIndex()
{
$this->view->registerCssFile('http://www.yiibook.com/themes/classic/css/yiibook.css');
并且在layout中使用
<?php
$this->beginPage();
?>
HTML/HEAD/BODY/....
<?php
$this->endPage();
?>
显示页面时,并未找到 注册的css
还有在yii\base\View类中,743行左右
protected function renderHeadHtml()
{
$lines = array();
if (!empty($this->metaTags)) {
$lines[] = implode("\n", $this->cssFiles);
}
if (!empty($this->linkTags)) {
$lines[] = implode("\n", $this->cssFiles);
}
if (!empty($this->cssFiles)) {
$lines[] = implode("\n", $this->cssFiles);
}
...
上面的linkTags metaTags 后面用的都是cssFiles,应该是复制的问题。
Thanks! I have fixed the issue you described. For the layout view, you need to add $this->head()
in the layout. Please refer to the "app" example.
ok.thanks.
Either in controller ($this->view->registerCssFile), widgets( same controller) and view(this->registerCssFile);
the layout master view added beginPage / endPage