return array(
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'name' => 'XXXXXX',
// preloading 'log' component
'preload' => array('log'),
// autoloading model and component classes
'import' => array(
'application.models.*',
'application.messages.*',
'application.components.*',
'application.extensions.bootstrap.helpers.*',
),
'aliases' => array(
'bootstrap' => realpath(__DIR__ . '/../extensions/bootstrap'), // change this if necessary
),
'modules' => array(
'gii' => array(
'generatorPaths' => array('bootstrap.gii'),
),
// 'gii' => array(
// 'class' => 'system.gii.GiiModule',
// 'password' => 'XXXXXX',
// // If removed, Gii defaults to localhost only. Edit carefully to taste.
// 'ipFilters' => array('XXXXXX'),
// ),
),
'components' => array(
'user' => array(
// enable cookie-based authentication
'allowAutoLogin' => true,
),
'bootstrap' => array(
'class' => 'bootstrap.components.TbApi',
),
// uncomment the following to enable URLs in path-format
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
),
// 'db' => array(
// 'connectionString' => 'sqlite:' . dirname(__FILE__) . '/../data/testdrive.db',
// ),
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=XXXXXXe',
'emulatePrepare' => true,
'username' => 'XXXXX',
'password' => 'XXXXX',
'charset' => 'utf8',
),
'errorHandler' => array(
// use 'site/error' action to display errors
'errorAction' => 'site/error',
),
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CFileLogRoute',
'levels' => 'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params' => array(
// this is used in contact page
'adminEmail' => 'webmaster@example.com',
),
);
yii-boostrap doesn't load css or js files
-
16-07-2023 - |
문제
Trying to get yii boostrap to work.
In config/main.php
<?php
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
return array(
'basePath' => dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..',
'theme'=>'bootstrap',
// preloading 'log' component
'preload' => array( 'log', ),
// autoloading model and component classes
'import' => array(
'application.models.*',
'application.components.*',
'application.modules.admin.models.*',
'application.modules.admin.*',
),
'modules' => array(
'gii' => array(
'class' => 'system.gii.GiiModule',
'password' => 'xxx',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters' => array( '127.0.0.1', '::1' ),
'generatorPaths'=>array(
'bootstrap.gii',
),
),
'admin' => array(
'components' => array(
'user'=>array(
'class' => 'WebUser',
'allowAutoLogin'=>true,
'loginUrl' => array('/admin/login'),
),
)
),
),
// application components
'components' => array(
'bootstrap'=>array(
'class'=>'bootstrap.components.Bootstrap',
),
'user' => array(
'allowAutoLogin' => true,
),
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
),
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=xxxx',
'emulatePrepare' => true,
'username' => 'xxx',
'password' => 'xxx',
'charset' => 'utf8',
),
'errorHandler' => array(
// use 'site/error' action to display errors
'errorAction' => 'site/error',
),
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CFileLogRoute',
'levels' => 'error, warning',
),
array(
'class' => 'CWebLogRoute',
),
),
),
),
'params' => array(
// this is used in contact page
'adminEmail' => 'webmaster@example.com',
),
);
in layouts/main.php
I have Yii::app()->bootstrap->register();
which then throws an error
include(Bootstrap.php): failed to open stream: No such file or directory
bootstrap.widgets
seem to be working as the proper code is generated, but what's missing is the css and js files to style everything correctly.
해결책
제휴하지 않습니다 StackOverflow