Yii 中的 Twitter Bootstrap [英] Twitter Bootstrap in Yii
问题描述
我对 Yii 和 Twitter Bootstrap 还很陌生,我正在尝试使用 bootstrap 提供的文件.我已经在 Yii 的受保护文件夹的扩展目录中解压了下载的文件夹,然后按照这个 http://www.cniska.net/yii-bootstrap/setup.html#setup 我的 main.php 中的代码如下所示:
I'm pretty new to Yii as well as Twitter Bootstrap, I am trying to use the files provided by bootstrap. I have unzipped the downloaded folder in extensions directory of protected folder in Yii, and followed this http://www.cniska.net/yii-bootstrap/setup.html#setup The code in my main.php looks like:
'preload'=>array('log','bootstrap'),
'import'=>array(
...
'application.extensions.bootstrap.widgets.*',
),
'modules'=>array(
'generatorPaths'=>array(
'bootstrap.gii',
),
),
'components' => array(
'bootstrap'=>array(
'class'=>'ext.bootstrap.components.Bootstrap',
),
),
我收到此错误
别名ext.bootstrap.components.Bootstrap"无效.确保它指向现有的 PHP 文件.
I get this error
Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file.
第 2 季度.除了将整个 bootstrap css 文件复制粘贴到 Yii 的 css 中,还有其他更好的方法吗?
Q2. Is there any better way other than just copy paste the whole bootstrap css file in Yii's css?
第三季度.我是否必须下载任何额外的东西才能使用 bootstrap twitter 提供的小部件,例如 $this->widget('ext.cssmenu.CssMenu',array(...); 下载的文件应该在哪里?
Q3. Do I have to download anything extra to use the widgets provided by bootstrap twitter like, $this->widget('ext.cssmenu.CssMenu',array(...); where should the downloaded files be located?
推荐答案
我想你可能下载了错误的文件!您不必从 twitter github 页面下载 bootstrap - 而是下载 yii 扩展,其中捆绑了所有 boostrap 文件.
I think you might be downloading the wrong files! You don't download bootstrap from the twitter github page - instead you download the yii extension, which has all the boostrap files bundled in.
以下是分步指南:
下载这个文件 - http://www.yiiframework.com/extension/bootstrap/files/yii-bootstrap-0.9.12.r211.zip - 为了稳定性,我会使用它而不是 alpha v 1.0.
Download this file - http://www.yiiframework.com/extension/bootstrap/files/yii-bootstrap-0.9.12.r211.zip - I'd use this rather than the alpha v 1.0 for stability.
解压
将解压后的文件夹重命名为bootstrap"
Rename the unzipped folder to 'bootstrap'
检查您是否拥有厄尼在下面提到的文件夹结构.
check that you have the folder structure ernie mentions below.
将您的新引导文件夹上传到 protected/extensions
upload your new bootstrap folder to protected/extensions
对这里给出的 protected/config/main.php 进行更改 - http://www.cniska.net/yii-bootstrap/setup.html#setup - 但看起来你已经这样做了.
make the changes to your protected/config/main.php given here - http://www.cniska.net/yii-bootstrap/setup.html#setup - but it looks like you've already done this.
现在一切正常.
这篇关于Yii 中的 Twitter Bootstrap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!