如何以手动方式将AdminLTE集成到Yii2 Basic中
你知道,yii2和adminlte就存在于此 但如果我使用这个使用作曲家,它不会给我一个教育。 你知道,我想一步一步地学习 所以我试着这样:如何以手动方式将AdminLTE集成到Yii2 Basic中,yii2,Yii2,你知道,yii2和adminlte就存在于此 但如果我使用这个使用作曲家,它不会给我一个教育。 你知道,我想一步一步地学习 所以我试着这样: class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; public $sourcePath = '@bower/'adminLTE'; public $css = [ 'adminLTE/
class AppAsset extends AssetBundle {
public $basePath = '@webroot';
public $baseUrl = '@web';
public $sourcePath = '@bower/'adminLTE';
public $css = [
'adminLTE/dist/css/AdminLTE.min.css',
'css/site.css',
];
public $js = [
'adminLTE/dist/js/app.js'
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
];
}
class AppAsset extends AssetBundle {
public $basePath = '@webroot';
public $baseUrl = '@web';
public $sourcePath = '@bower/'adminLTE';
public $css = [
'adminLTE/dist/css/AdminLTE.min.css',
'css/site.css',
];
public $js = [
'adminLTE/dist/js/app.js'
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
];
}
但是,下面的css和js都是404
感谢您提供的任何帮助如果您想手动添加AdminLTE,则无需将其放入
bower
文件夹中
将其放在/web
文件夹中(对于高级模板,它是/frontend/web
或/backend/web
)
您已经为此文件夹设置了AppAsset,但必须删除
$sourcePath
,因为设置后,$basePath
和$baseUrl
将被覆盖。如果要手动添加AdminLTE,则无需将其放入bower
文件夹中
将其放在/web
文件夹中(对于高级模板,它是/frontend/web
或/backend/web
)
您已经为此文件夹设置了AppAsset,但必须删除
$sourcePath
,因为设置后,$basePath
和$baseUrl
将被覆盖。不要在供应商内部添加主题,以便手动安装主题。遵循以下提到的步骤
步骤1:下载您的adminlte并在根目录中创建一个名为theme的目录
ex. your_project/basic/themes ( i.e outside the web directory)
步骤2:将adminlte主题文件夹粘贴到新创建的主题目录中
第3步:现在您需要创建资产来注册adminlte主题所需的所有CSS和js
转到你的项目/basic/assets目录,创建一个新文件,比如说,AdminLTEAsset.php
步骤5:在/config/web.php文件中添加以下路径图
'components'=>[
'view' => [
'theme' => [
'pathMap' => ['@app/views' => '@app/themes/adminlte'],
'baseUrl' => '@web/../themes/adminlte',
],
],
]
不要为手动安装主题而在供应商内部添加主题。遵循以下提到的步骤 步骤1:下载您的adminlte并在根目录中创建一个名为theme的目录
ex. your_project/basic/themes ( i.e outside the web directory)
步骤2:将adminlte主题文件夹粘贴到新创建的主题目录中
第3步:现在您需要创建资产来注册adminlte主题所需的所有CSS和js
转到你的项目/basic/assets目录,创建一个新文件,比如说,AdminLTEAsset.php
步骤5:在/config/web.php文件中添加以下路径图
'components'=>[
'view' => [
'theme' => [
'pathMap' => ['@app/views' => '@app/themes/adminlte'],
'baseUrl' => '@web/../themes/adminlte',
],
],
]
嵌入管理lte主题i yii2 basic 1) 使用composer创建yii项目 苏多杜 cd/var/www/html 作曲家创建项目yiisoft/yii2应用程序basic 2.0.4 2) 现在创建一个可访问的 chmod 777-R项目名称 3) 使用下载管理员lte主题 git克隆 4) 现在更新作曲家 作曲家更新 如果令牌错误,则在git中创建帐户,并通过单击generate new token在设置选项卡中创建令牌 复制并提供给作曲家 5) 在config中更新web.php文件
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'layout'=>'column2',
'layoutPath'=>'@app/themes/adminLTE/layouts',
'components' => [
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
''=>'site/index',
'<action:(index|login|logout)>'=>'site/<action>',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>'
],
],
'view' => [
'theme' => [
'pathMap' => ['@app/views' => '@app/themes/adminLTE'],
'baseUrl' => '@web/../themes/adminLTE',
],
],
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'n0VkMX1RmIa_ovJmwR3Gn_hdZyQ7SyKe',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => require(__DIR__ . '/db.php'),
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
//$config['modules']['gii'] = 'yii\gii\Module';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'generators' => [ //here
'crud' => [ // generator name
'class' => 'yii\gii\generators\crud\Generator', // generator class
'templates' => [ //setting for out templates
'custom' => '@vendor/bmsrox/yii-adminlte-crud-template', // template name => path to template
]
]
],
];
}
return $config;
7) 如果配置错误,则
更新apche2
通过使用命令
a2enmod重写
并使用
服务apache2重新启动
已完成
祝你好运嵌入管理lte主题i yii2 basic 1) 使用composer创建yii项目 苏多杜 cd/var/www/html 作曲家创建项目yiisoft/yii2应用程序basic 2.0.4 2) 现在创建一个可访问的 chmod 777-R项目名称 3) 使用下载管理员lte主题 git克隆 4) 现在更新作曲家 作曲家更新 如果令牌错误,则在git中创建帐户,并通过单击generate new token在设置选项卡中创建令牌 复制并提供给作曲家 5) 在config中更新web.php文件
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'layout'=>'column2',
'layoutPath'=>'@app/themes/adminLTE/layouts',
'components' => [
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
''=>'site/index',
'<action:(index|login|logout)>'=>'site/<action>',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>'
],
],
'view' => [
'theme' => [
'pathMap' => ['@app/views' => '@app/themes/adminLTE'],
'baseUrl' => '@web/../themes/adminLTE',
],
],
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'n0VkMX1RmIa_ovJmwR3Gn_hdZyQ7SyKe',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => require(__DIR__ . '/db.php'),
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
//$config['modules']['gii'] = 'yii\gii\Module';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'generators' => [ //here
'crud' => [ // generator name
'class' => 'yii\gii\generators\crud\Generator', // generator class
'templates' => [ //setting for out templates
'custom' => '@vendor/bmsrox/yii-adminlte-crud-template', // template name => path to template
]
]
],
];
}
return $config;
7) 如果配置错误,则
更新apche2
通过使用命令
a2enmod重写
并使用
服务apache2重新启动
已完成
祝您好运有关配置管理lte的更多详细信息,请参考带有模块后端的Yi2初学者工具包。有关配置管理lte的更多详细信息,请参考带有模块后端的Yii2初学者工具包。谢谢,但我用的是yii2基本型。Nit advanceSo文件夹是
/web
,如我前面所说。谢谢,但我使用了Yi2 basic。Nit advanceSo文件夹是/web
,就像我前面说的。