yii多主题如何设置

新手提问 · admini · 于 6年前 发布 · 5117 次阅读
 $config['components'][ 'view'][ 'theme']=[
     // 'basePath' => '@app/themes/spring',
     // 'baseUrl' => '@web/themes/spring',
     'pathMap' => [
         '@app/views' => [
             '@app/views/pc',
             '@app/views/mobile',
         ]
     ],
 ];

我这样设置以后

然后再控制器里修改 布局文件夹

   public $layout = 'return';

然后在views/pc/layouts/return.php文件里引入main.php

<?php use yii\helpers\Html;

$this->beginContent('main'); ?>
    <center>
        <?=$content; ?>
    </center>
    <p/>
    <center>
        <?=Html::button('返回',['onclick'=>'javacript:history.go(-1)','class'=>'btn btn-success btn-block'])?>
    </center>
<?php $this->endContent(); ?>

报错提示视图文件不存在 The view file does not exist: main 请问怎么解决

共收到 1 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册