Abdullah Shaikh
Abdullah Shaikh

Reputation: 2604

Gii With Yiibooster and YiiBoilerplate

I am new to Yii framework, infact new to php. I have downloaded YiiBoilerplate (clevertech-YiiBoilerplate-abe2511)and followed the instructions mentioned on http://www.yiiframework.com/wiki/374/yiiboilerplate-setup-a-professional-project-structure-in-seconds/ page.

I want to access Gii but I am not sure how do I do that ? I am trying to use

[http://localhost:8080/pm1/backend/www/index.php?r=gii] url but it gets to the default backend page and not to the gii page.

Without YiiBoilerplate I was able to access Gii using [http://localhost:8080/pm1/index?r=gii]

Please let me know how do I access Gii when using YiiBoilerplate or point to tutorial if any configuration is required.

Upvotes: 1

Views: 4759

Answers (1)

bool.dev
bool.dev

Reputation: 17478

The default YiiBoilerplate has gii disabled, so you'll have to enable it. If you check the backend/www/index.php file you'll see the line:

$config=require('backend/config/main.php');

which tells us the exact config file that is being loaded: backend/config/main.php.
Within backend/config/main.php enable the gii module by uncommenting the following lines:

'modules' => array(
    'gii' => array(
        'class' => 'system.gii.GiiModule',
        'password' => 'clevertech',
        'generatorPaths' => array(
            'bootstrap.gii'
        )
    )
),

Now you can access gii by following the url: http://localhost:8080/pm1/backend/www/index.php/gii/default/login.

A few pointers:

  • by default urlFormat is path that's why even after enabling gii index.php?r=gii will not work
  • also they have set showScriptName to false, which means the index.php will not be shown, to work without index.php you'll have to do some web-server redirects, read the guide on tips for that.
  • incase you don't want to hide index.php just comment this line in backend/config/main-local.php:

    'showScriptName' => $params['url.showScriptName'],
    
  • also read the gii part of the guide.

Upvotes: 3

Related Questions