和java swing中类似yii framework 中的layout 也允许嵌套,这是通过ccontentdecorator来实现的,不过代码中并不需要 直接使用ccontentdecorator ,而是在定义layout使用
$this->beginContent('path/to/view');
// ... content to be decorated
$this->endContent();其中view 为另外一个布局。
本例定义四个Layout,一个嵌套一个:

///main.php
name; ?>
Widget Demo
///row1.php
beginContent('/layouts/row2'); ?>
endContent(); ?>
//row2.php
beginContent('/layouts/row3'); ?>
endContent(); ?>
///row3.php
beginContent('/layouts/main'); ?>
endContent(); ?>显示结果如下:

以上就是Yii Framework教程(13) UI 组件 ContentDecorator示例的内容,更多相关内容请关注PHP中文网(www.php.cn)!










