I can not show static pages. Try to do this as described in the doc here - http://stuff.cebe.cc/yii2-guide.pdf (on page 100), but when I turn on prettyurl it doesn't work.
Added to urlManager rules:
'urlManager' => array(
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => array(
'' => 'site/index',
'login' => 'site/login',
'contacts' => 'site/contact',
'<view:(break)>'=>'/site/page?&view=<view>',
),
),
and then added to SiteController:
public function actions()
{
return [
...
'page' => [
'class'=>'yii\web\ViewAction',
],
];
}
Then the views / website / pages / break.php are created
<h1>View static page Break</h1>
But I get an error: Not found (# 404) Failed to resolve the request: site / page? & view = break
If I turn off prettyUrl:
//'enablePrettyUrl'=>true
then can i see my page by typing url: index.php? r = site / page & view = break
What is wrong with ViewAction?
almix source
share