Yii2学习笔记二十:Yii2 主题Themes使用
一、config main.php文件中components添加配置:
'view'=>[ 'theme'=>[ 'basePath'=>'@app/themes/basic', 'baseUrl'=>'@web/themes/exception', 'pathMap'=>[ '@app/views'=>[ '@app/themes/exception', '@app/themes/basic' ], '@app/modules'=>'@app/themes/basic/modules', '@app/modules'=>'@app/themes/basic/widgets', ] ] ],
二、视图文件中使用方法:
$this->theme->getUrl('images/hire.png'); $this->theme->getPath('images/hire.png'); //主题配置 //$arr[0]= '@app/themes/'.Yii::$app->params['web']['WEB_THEME']; $arr[0]= '@app/themes/'.'exception'; Yii::$app->view->theme->pathMap['@app/views']=$arr;
文章
总共 0 条评论