URL目錄
<?php echo Yii::app()->request->baseUrl; ?>
網頁標題信息
<?php echo CHtml::encode($this->pageTitle); ?>
網站名稱,配置信息中聲明<?php echo CHtml::encode(Yii::app()->name); ?>
版權信息
<?php echo Yii::powered(); ?>
調用模板片段<?php $this->widget('zii.widgets.CMenu',array('items'=>array(..))) ?>
<?php $this->widget('zii.widgets.CBreadcrumbs', array( 'links'=>array(..)))?>
輸出組件主要內容<?php echo $content; ?>
第二部分,分析內容輸出調用方式CApplication.run->CWebApplication.processRequest->CWebApplication.runController->$controller.init,
$controller.run($actionID)->PostController.actionID(){ .. $this->render()..}
以上是調用經過,處理模板是在 CController.render 方法中,先處理action生成output作爲內容,然後再處理layout模板進行輸出.1,用佈局作爲內容處理過程
$this->beginContent('/layouts/main');->$this->beginWidget('CContentDecorator',array('view'=>$view, 'data'=>$data));
...
$this->endContent(); ->$this->endWidget('CContentDecorator');
第三部分,beginWidget 和 endWidget 方式加載模板內容beginWidget-> COutputProcessor.init()
{
ob_start();
ob_implicit_flush(false);
}
...
endWidget->COutputProcessor.run()
{
$output=ob_get_clean();
$this->processOutput($output);
}
以上是YII框架處理視圖的基本形式,這種方式主要用於在代碼中直接傳參數,一些開源的CMS中,則是通過後臺來自定義參數配置