【发布时间】:2013-03-12 15:42:52
【问题描述】:
我是 Yii 新手,想实现 Twitter Bootstrap 扩展,我关注了 cniska 但显然我做错了什么。
当我在浏览器中加载带有扩展代码的页面时,图像/效果不会加载。
在我的 html 页面中,我找到了这个简单的切换按钮 here。
<?php $this->widget('bootstrap.widgets.TbButton', array(
'buttonType'=>'button',
'type'=>'primary',
'label'=>'Toggle me',
'toggle'=>true,
)); ?>
这样的结果就像我刚刚做了一个没有应用任何类的简单 HTML 按钮,一个“裸”样式按钮,所以说吧。
我的配置/main.php:
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Test App',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'<password>',
'ipFilters'=>array('127.0.0.1','::1'),
),
),
'components'=>array(
'user'=>array(
'allowAutoLogin'=>true,
),
'bootstrap'=>array(
'class'=>'bootstrap.components.Bootstrap',
),
'theme'=>'bootstrap', -// requires you to copy the theme under your themes directory
'modules'=>array(
'gii'=>array(
'generatorPaths'=>array(
'bootstrap.gii',
),
),
),
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=<bdname>',
'emulatePrepare' => true,
'username' => '<bd username>',
'password' => '<bd password>',
'charset' => 'utf8',
),
'errorHandler'=>array(
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
),
),
),
// 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 的框架以及扩展。 有什么建议吗?
提前致谢
【问题讨论】:
-
您是否尝试过预加载引导程序,即
preload=>array('log','bootstrap')? -
你可能需要注册css、js。见here
-
你使用的是哪个版本的 yii-bootstap?
-
是的,我已经做到了,结果是一样的。
标签: php twitter-bootstrap yii yii-extensions