I want to add a new page to it, in siteController.php I add
public function actionAgreement()
{
$this->render('agreement');
}
and in /protected/views/site/
I add a new file
agreement.php
the content is
<?php
$this->pageTitle=Yii::app()->name . ' - '. Yii::t('translation','Agreement');
$this->breadcrumbs[] = Yii::t('translation','Agreement');?>
<h1><?php echo Yii::t('translation','Agreement'); ?></h1>
<p>
blahblahblahblahblah
</p>
but after run
http://mysite.com/index.php?r=site/Agreement
end up getting this error
CException
描述
SiteController 无法找到请求的视图 "agreement".
源文件
/wwwroot/yii/framework/web/CController.php(807)
00795: {
00796: if(($viewFile=$this->getViewFile($view))!==false)
00797: {
00798: $output=$this->renderFile($viewFile,$data,true);
00799: if($processOutput)
00800: $output=$this->processOutput($output);
00801: if($return)
00802: return $output;
00803: else
00804: echo $output;
00805: }
00806: else
00807: throw new CException(Yii::t(‘yii’,’{controller} cannot find the requested view “{view}”.’,
00808: array(’{controller}’=>get_class($this), ‘{view}’=>$view)));
00809: }
any idea?
If I change function actionAgreement content to
$this->render('index');
it can display the index page.
Why the file exists but raise this view page not found error?