Yii-bootstrap не даёт войти в Gii

Общие вопросы по использованию фреймворка. Если не знаете как что-то сделать и это про Yii, вам сюда.
Ответить
Аватара пользователя
federal
Сообщения: 10
Зарегистрирован: 2013.11.03, 12:25

Yii-bootstrap не даёт войти в Gii

Сообщение federal »

Здравствуйте!!! Начал изучать Yii. Столкнулся с одной проблемкой, может подскажете как быть.

В общем скачал yii-bootstrap-2.1.0.r355.zip (думаю знаете что это). Поставил как полагается, всё работает. Только одно НО - после установки yii-bootstrap, не могу зайти в Gii, выдаёт следующую ошибку:
Псевдоним "gii.GiiModule" неверен. Убедитесь, что он указывает на существующий PHP файл.
Открываю файл с настройками, отключаю бутстрап, Gii открывается. Что за бяка такая? :?:
Аватара пользователя
AlexxxT
Сообщения: 59
Зарегистрирован: 2013.02.17, 15:17
Откуда: Kiev

Re: Yii-bootstrap не даёт войти в Gii

Сообщение AlexxxT »

Думаю стоит написать, как подключали.
Аватара пользователя
sluchainiyznak
Сообщения: 617
Зарегистрирован: 2013.05.19, 17:51
Откуда: ХМАО-Югра, г. Сургут
Контактная информация:

Re: Yii-bootstrap не даёт войти в Gii

Сообщение sluchainiyznak »

конфиг-файл в студию?
Аватара пользователя
federal
Сообщения: 10
Зарегистрирован: 2013.11.03, 12:25

Re: Yii-bootstrap не даёт войти в Gii

Сообщение federal »

AlexxxT писал(а):Думаю стоит написать, как подключали.
Скачал свежий релиз Yii-Bootstrap.

Распаковал в protected/extensions/bootstrap, скопировал папку theme в директорию с темами Yii и добавил строчки в конфигурацию приложения:

Код: Выделить всё

<?php

// uncomment the following to define a path alias
//Yii::setPathOfAlias('local','path/to/local-folder');
Yii::setPathOfAlias('bootstrap',dirname(__FILE__).'/../extensions/bootstrap');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(

    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'Студенты',
    'language'=>'ru',    

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

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

    'modules'=>array(
        // uncomment the following to enable the Gii tool
        
        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'12345',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
        ),
        
    ),

    // application components
    'components'=>array(
        'user'=>array(
            // enable cookie-based authentication
            'allowAutoLogin'=>true,
        ),
        // uncomment the following to enable URLs in path-format
        
        'urlManager'=>array(
            'urlFormat'=>'path',
            'rules'=>array(
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),
        
        'db'=>array(
            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),
        // uncomment the following to use a MySQL database

        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=yii',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
        ),
        
        'errorHandler'=>array(
            // use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
        'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning',
                ),
                // uncomment the following to show log messages on web pages
                /*
                array(
                    'class'=>'CWebLogRoute',
                ),
                */
            ),
        ),
    ),

    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params'=>array(
        // this is used in contact page
        'adminEmail'=>'webmaster@example.com',
    ),
    //bootstrap-start------------------------------------------------------------------------------    
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
    'modules'=>array(
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),
    ),
    'components'=>array(
        'bootstrap'=>array(
            'class'=>'bootstrap.components.Bootstrap',
        ),
        
    ),
    ///////////////////////////////////////////// bootstrap-end
    
);
Аватара пользователя
sluchainiyznak
Сообщения: 617
Зарегистрирован: 2013.05.19, 17:51
Откуда: ХМАО-Югра, г. Сургут
Контактная информация:

Re: Yii-bootstrap не даёт войти в Gii

Сообщение sluchainiyznak »

Код: Выделить всё

'modules'=>array(
        // uncomment the following to enable the Gii tool
        
        'gii'=>array(
...
        ),
        
    ),
Внимательно взгляните! повторяется настроичка
Аватара пользователя
federal
Сообщения: 10
Зарегистрирован: 2013.11.03, 12:25

Re: Yii-bootstrap не даёт войти в Gii

Сообщение federal »

sluchainiyznak писал(а):Внимательно взгляните! повторяется настроичка
Ага, увидел. Это значит, что теперь нужно одну из них убирать?
Аватара пользователя
sluchainiyznak
Сообщения: 617
Зарегистрирован: 2013.05.19, 17:51
Откуда: ХМАО-Югра, г. Сургут
Контактная информация:

Re: Yii-bootstrap не даёт войти в Gii

Сообщение sluchainiyznak »

конечно, причем чтоб генератор генерил именно бутстраповские шаблоны, убираем это :

Код: Выделить всё

'modules'=>array(
        // uncomment the following to enable the Gii tool
        
        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'12345',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
        ),
        
    ), 
Аватара пользователя
federal
Сообщения: 10
Зарегистрирован: 2013.11.03, 12:25

Re: Yii-bootstrap не даёт войти в Gii

Сообщение federal »

sluchainiyznak писал(а):конечно, причем чтоб генератор генерил именно бутстраповские шаблоны, убираем это
Благодарен за помощь! Всё получилось.
flam
Сообщения: 129
Зарегистрирован: 2011.04.10, 11:23

Re: Yii-bootstrap не даёт войти в Gii

Сообщение flam »

И 'db' зачем 2
Аватара пользователя
federal
Сообщения: 10
Зарегистрирован: 2013.11.03, 12:25

Re: Yii-bootstrap не даёт войти в Gii

Сообщение federal »

Возникла ошибка:
Псевдоним "gii.GiiModule" неверен. Убедитесь, что он указывает на существующий PHP файл.
Вот конфиг:

Код: Выделить всё

<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'FloWeb',
    'language'=>'ru',
    'charset'=>'utf-8',

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

    // autoloading model and component classes
    'import'=>array(
        'application.models.*',
        'application.components.*',
    ),
    
    'modules'=>array(
        // uncomment the following to enable the Gii tool
        /*
        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'111500',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
        ),
        */
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),
    ),
    

    // application components
    'components'=>array(
        'user'=>array(
            // enable cookie-based authentication
            'allowAutoLogin'=>true,
        ),
        // uncomment the following to enable URLs in path-format
        /*
        'urlManager'=>array(
            'urlFormat'=>'path',
            'rules'=>array(
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),
        */
        /*
        'db'=>array(
            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),*/
        // uncomment the following to use a MySQL database
        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=floweb',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => 'flo_',
        ),
        'errorHandler'=>array(
            // use 'site/error' action to display errors
            'errorAction'=>'site/error',
        ),
        'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CFileLogRoute',
                    'levels'=>'error, warning',
                ),
                // uncomment the following to show log messages on web pages
                /*
                array(
                    'class'=>'CWebLogRoute',
                ),
                */
            ),
        ),
         'bootstrap'=>array(
            'class'=>'bootstrap.components.Bootstrap',
        ),
    ),

    // 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-bootstrap 
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
);
Кто подскажет, что опять не так? :?:
Аватара пользователя
federal
Сообщения: 10
Зарегистрирован: 2013.11.03, 12:25

Re: Yii-bootstrap не даёт войти в Gii

Сообщение federal »

federal писал(а):Кто подскажет, что опять не так? :?:
Разобрался! Надо было писать так:

Код: Выделить всё

        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'1234',
            'ipFilters'=>array('127.0.0.1','::1'),
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),
 
Nafania
Сообщения: 1227
Зарегистрирован: 2011.01.31, 13:12

Re: Yii-bootstrap не даёт войти в Gii

Сообщение Nafania »

Строку 'class'=>'system.gii.GiiModule', верните на место.
Ответить