Chinaunix首页 | 论坛 | 博客
  • 博客访问: 103478
  • 博文数量: 46
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-20 18:33
个人简介

Direction Target

文章分类

全部博文(46)

文章存档

2015年(2)

2014年(22)

2013年(9)

2012年(13)

我的朋友

分类: Web开发

2015-07-12 19:16:52

 

 

1.       解压yiistrap-master.zip重命名为bootstrap 放到protected\extensions\目录下

  protected
    └── extensions
       └── bootstrap
          ├── assets
             ├── css
             ├── img
             ├── js
             └── less
          ├── behaviors
          ├── components
          ├── gii
          ├── helpers
          └── widgets

 

2.配置 protected/config/main.php

<?php
// main configuration
return array(
         ...
    // path aliases
    'aliases' => array(
        ...
       // 'bootstrap' => realpath(__DIR__ . '/../extensions/bootstrap'), // change this if necessary
         'bootstrap' => dirname(__FILE__) . '/../extensions/bootstrap', //根据bootstrap位置而定
    ),
    // import paths
    'import' => array(
        ...
        'bootstrap.helpers.TbHtml',
    ),
    // application modules
    'modules' => array(
        ...
        'gii' => array(
             ...
            'generatorPaths' => array('bootstrap.gii'),
        ),
    ),
    // application components
    'components' => array(
        ...
        'bootstrap' => array(
            'class' => 'bootstrap.components.TbApi',   
        ),
    ),
);

 3.视图注册bootstrap  protected/views/layouts/main.php文件开始添加

<?php Yii::app()->bootstrap->register(); ?>

4.测试某一视图中

<?php $this->widget('bootstrap.widgets.TbDetailView', array(
    'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
    'attributes'=>array(
        array('name'=>'firstName', 'label'=>'First name'),
        array('name'=>'lastName', 'label'=>'Last name'),
        array('name'=>'language', 'label'=>'Language'),
    ),
)); ?>


阅读(953) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~