检查此扩展程序
Yii 管理模块
打开 AdminModule.php,有用于配置管理模块的位置。我只是发布你需要的部分
public function getAssetsUrl()
{
if (!isset($this->assetsUrl))
{
$assetsPath = Yii::getPathOfAlias('admin.assets');
$this->assetsUrl = Yii::app()->assetManager->publish($assetsPath, false, -1, $this->forceCopyAssets);
}
return $this->assetsUrl;
}
protected function registerCoreCss()
{
Yii::app()->clientScript->registerCssFile($this->getAssetsUrl() . '/css/admin.css');
}
protected function registerScript(){
$js_arr = array('jquery.min.js', 'jqueryui.js'); //put what js file name that you need to import from admin assets folder
foreach($js_arr as $filename){
Yii::app()->getClientScript()->->registerScriptFile($this->getAssetsUrl().'/js/'.$filename, CClientScript::POS_END);
}
}
然后在init()
public function init(){
//set import ...
// configure module ...
// configure component ....
$this->registerCoreCss();
$this->registerScript();
}