내가 자동으로 템플릿 을 변경하는 내 응용 프로그램에 대한 싶습니다 그래서 메인 프론트 엔드/설정 /에이 코드를 추가 http://www.yiiframework.com/doc-2.0/guide-output-theming.html 다음이 구조의 프론트 엔드/웹/테마/myTheme
를 만들었습니다. PHP Yii2 고급 변화 전망의 기본 경로 (테마)
'components' => [
'view' => [
'theme' => [
'basePath' => '@app/themes/myTheme',
'baseUrl' => '@web/themes/myTheme',
'pathMap' => [
'@app/views' => '@app/themes/myTheme',
],
],
],
],
그러나 나는 "/var/www/html/myProject/app/frontend/views/site/index.php"뷰 파일이 존재하지 않는다는 오류가 계속 ??? 1. 어떻게 뷰의 기본 경로를 변경할 수 있습니다
는 나는 또한 나의 질문은 How to change default view path in Yii2?
public function getViewPath()
{
return Yii::getAlias('@web/themes/myTheme/site');
}
에 따라 컨트롤러 내부에이 기능을 넣을려고? 2. 세션 중에 common/config/main.php 설정을 변경할 수 없으므로 어떻게 자동으로 할 수 있습니까?
사이트 컨트롤러
class SiteController extends Controller
{
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['index'],
'allow' => true,
'roles' => ['?'],
],
[
'actions' => ['index'],
'allow' => true,
'roles' => ['@'],
],
],
],
];
}
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
/**
* Displays homepage.
*
* @return mixed
*/
public function actionIndex()
{
$searchModel = new ProductSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
}
당신이 저에게 당신의 컨트롤러를 게재 할 수 있습니까? – hesselek
간단한 컨트롤러 – leila