YiiBooster theme not working

别说谁变了你拦得住时间么 提交于 2019-12-11 04:08:54

问题


i'm newbie to yii & i'm trying to install booster as well described in the home page but without sucess.

the extension works, i generated CRUDs using 'bootstrap.gii' but i steel having the classic blueprint theme. there is my view output :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="language" content="en" />

    <!-- blueprint CSS framework -->
    <link rel="stylesheet" type="text/css" href="/thouraya_booster/css/screen.css" media="screen, projection" />
    <link rel="stylesheet" type="text/css" href="/thouraya_booster/css/print.css" media="print" />
    <!--[if lt IE 8]>
    <link rel="stylesheet" type="text/css" href="/thouraya_booster/css/ie.css" media="screen, projection" />
    <![endif]-->

    <link rel="stylesheet" type="text/css" href="/thouraya_booster/css/main.css" />
    <link rel="stylesheet" type="text/css" href="/thouraya_booster/css/form.css" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="/thouraya_booster/assets/b50f179f/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/thouraya_booster/assets/b50f179f/css/bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css" href="/thouraya_booster/assets/b50f179f/css/bootstrap-yii.css" />
<link rel="stylesheet" type="text/css" href="/thouraya_booster/assets/b50f179f/css/jquery-ui-bootstrap.css" />
<script type="text/javascript" src="/thouraya_booster/assets/f74bdb93/jquery.js"></script>
<script type="text/javascript" src="/thouraya_booster/assets/b50f179f/js/bootstrap.bootbox.min.js"></script>
<script type="text/javascript" src="/thouraya_booster/assets/b50f179f/js/bootstrap.js"></script>
<title>My Web Application</title>
</head>

i tried to add manually the bootsrtap theme as it use to be with chris's bootstrap extention but i'm getting this error message Bootstrap and its behaviors do not have a method or closure named "register".

i tried to manually modify the layouts/main.php exchanging the blueprint loading css by <?php echo Yii::app()->bootstrap->registerCoreCss(); ?> but it dosn't work

i even tried a chmod777 for if access is denied to some css file and the extension is then replacing it by the yii's default one.

here is how my config file looks like:

...

// preloading 'log' component
    'preload'=>array(
            'log',
            'bootstrap',
            ),

    // autoloading model and component classes
    'import'=>array(
        'application.models.*',
        'application.components.*',
    ),

    'modules'=>array(

        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'root',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
                        'generatorPaths' => array(
                            'bootstrap.gii'
                         ),
        ),
    ),

    // application components
    'components'=>array(

                'bootstrap' => array(
                        'class' => 'ext.bootstrap.components.Bootstrap',
                        'responsiveCss' => true,
                ),
...

I don't know if i'm missing something somewhere.


回答1:


I had the exact same problem, here is how I solved it:

  1. I created a new clean webapp (using yiic webapp) and installed YiiBooster as you have
  2. Get YiiBoilerplate and unzip it somewhere
  3. Go to {unzipped}backend/views/layouts/ and grab main.php, column1.php and column2.php
  4. create a new theme in your webapp under the /themes folder (I called it 'booster')
  5. Copy the three files from (3) into themes/booster/views/layouts
  6. In your main.php add 'theme' => 'booster' as a top-level entry of the array (I put it first)

P.S. Love your Avatar...




回答2:


In file views/layouts/main.php delete in HEAD Yii::app()->bootstrap->register();




回答3:


I got simpler, step-by-step method:

  • Extract yiibooster to extensions folder and rename the folder into "yiibooster"
  • Add the following code in /protected/config/main.php

Yii::setPathOfAlias('booster', dirname(__FILE__) . DIRECTORY_SEPARATOR . '../extensions/yiibooster');

  • Still in the /protected/config/main.php components add:

'bootstrap' => array( 'class' => 'booster.components.Bootstrap', ),

  • In any controller I want to use YiiBooster widgets, just put the following code:

public function filters() { return array( array('booster.filters.BootstrapFilter - delete') ); }

  • And thats it! Now Try to put some button in your view, for example:

$this->widget( 'booster.widgets.TbButton', array( 'label' => 'Primary', 'context' => 'primary', ) );

Trust me, this really works. I've applied it to my project.

Source:

http://www.yiiframework.com/forum/index.php/topic/52918-yiibooster-installation-steps/



来源:https://stackoverflow.com/questions/14468373/yiibooster-theme-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!