rag*_*hul 6 yii yii-extensions
任何人都可以告诉我如何添加延伸到我的yii?我用谷歌搜索并下载了Bootstrap 0.9.8扩展,并按照其中描述的步骤进行了操作,但它对我不起作用.我正在使用Ubuntu,你能不能一步一步地解释我只是初学者.
我不知道如何添加延伸到yii
@raghulrnair,假设你对yii有一些基本的了解.如果没有,请阅读Yii doc http://www.yiiframework.com/doc/guide/1.1/en/quickstart.what-is-yii
与http://www.cniska.net/yii-bootstrap/setup.html#setup一起解释它
1)下载引导程序扩展,并将其解压缩到"protected/extensions/bootstrap".完成此步骤后,您必须看到以下文件夹.
protected/extensions/bootstrap/assets
protected/extensions/bootstrap/gii
protected/extensions/bootstrap/components
protected/extensions/bootstrap/lib
protected/extensions/bootstrap/widgets
Run Code Online (Sandbox Code Playgroud)
2)" 应用程序配置 " 在安装扩展时起着重要作用.默认情况下,此配置将在php文件中(即protected/config/main.php)
3)只需编辑该文件并搜索"预加载".如果找到,则将"bootstrap"添加到该数组
'preload'=>array( 'log', 'bootstrap'),
Run Code Online (Sandbox Code Playgroud)
如果没找到,
'preload'=>array('bootstrap'),
Run Code Online (Sandbox Code Playgroud)
4)现在搜索"components",然后像下面一样向该数组添加bootstrap
'components'=>array(
.....
'bootstrap'=>array(
'class'=>'ext.bootstrap.components.Bootstrap',
),
),
Run Code Online (Sandbox Code Playgroud)
5)如果要自动生成引导代码(crud,views,models等..),请执行以下步骤.(如果您不想要,这是可选的)在"modules"配置中向gii添加bootstrap.
'modules'=>array(
.....
'gii'=>array(
.....
'generatorPaths'=>array(
'bootstrap.gii',
),
),
),
Run Code Online (Sandbox Code Playgroud)
6)您的配置已完成.设置已完成.
7)在视图中使用bootstrap开始编码 或使用gii生成代码.
许多例子见http://www.cniska.net/yii-bootstrap/
例如,如果要显示菜单,请编辑视图文件并添加此代码.
<?php $this->widget('bootstrap.widgets.TbMenu', array(
'type'=>'tabs', // '', 'tabs', 'pills' (or 'list')
'stacked'=>false, // whether this is a stacked menu
'items'=>array(
array('label'=>'Home', 'url'=>'#', 'active'=>true),
array('label'=>'Profile', 'url'=>'#'),
array('label'=>'Messages', 'url'=>'#'),
),
)); ?>
Run Code Online (Sandbox Code Playgroud)
8)多数民众赞成.