我安装了 Yii-Bootstrap 并将其保存在 protected/extensions 文件夹中。之后,我提取 zip 文件并将其命名为 bootstrap。作为http://www.cniska.net/yii-bootstrap/setup.html的文档。
我像这样更改文件 config/main.php。但我无法得到结果。如果我做错了,请在这里建议我如何在 yii 上使用引导程序。
<?php
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/extensions/bootstrap');
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Tantra Songs',
'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
// preloading 'log' component
'preload'=>array('log','application.ext.bootstrap.*'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.ext.bootstrap.*',
'application.modules.user.models.*',
'application.modules.user.components.*',
),
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'generatorPaths'=>array(
'bootstrap.gii',
),
),
'user'=>array(
# encrypting method (php hash function)
'hash' => 'md5',
# send activation email
'sendActivationMail' => true,
# allow access for non-activated users
'loginNotActiv' => false,
# activate user on registration (only sendActivationMail = false)
'activeAfterRegister' => false,
# automatically login from registration
'autoLogin' => true,
# registration path
'registrationUrl' => array('/user/registration'),
# recovery password path
'recoveryUrl' => array('/user/recovery'),
# login form path
'loginUrl' => array('/user/login'),
# page after login
'returnUrl' => array('/user/profile'),
# page after logout
'returnLogoutUrl' => array('/user/login'),
),
),
// application components
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
'bootstrap'=>array(
'class'=>'bootstrap.components.Bootstrap',
),
// 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=nt_songs',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'tablePrefix' => 'nt_',
),
'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',
),
*/
),
),
),
);