关于当前版本(1.1.x)的theme设置

一、theme/classic目录结构:

theme

__|-classic

______|-css

______|-images

______|-views

________|-layouts

________|-site

________|-model

二、设置1:

1、config中设置’theme’=>‘classic’;

2、在protected/Controller中修改默认设置public $layout=‘main’;

3、注释modelController中设置public $layout='column2’的设置;


此时,配置的theme生效,即可以找到classic下对应的layouts/main配置,且对全站页面,自定义theme都生效。

三、设置2:

1、config中设置’theme’=>‘classic’;

2、在protected/Controller中修改默认设置public $layout=‘main’;

3、取消注释modelController中设置public $layout='column2’的设置;


此时,自定义theme对全站都生效,但是对于model相关的页面则有一个问题:

column2中引用的content(<?php $this->beginContent(‘application.views.layouts.main’); ?>)还是为默认的protected/views/layouts下的main配置。

当然,这种问题,可以通过合并column2中的相关内容合并到main中去解决,但是还是想知道是否有其他设置的办法来实现content路径的一致性。谢谢!

用这个:<?php $this->beginContent(’/layouts/main’); ?>

奏效…谢谢,原来此处还可以直接给出path。

建议《The Definite Guide to Yii》中每个章节增加应用实例…

api中针对用户端的如果也能加入应用实例就更好了…

view的指定有三种,具体请参见:http://www.yiiframework.com/doc/api/CController#resolveViewFile-detail