vova07 / yii2-start

Yii2-Start application
Other
273 stars 115 forks source link

Using module generate by gii #107

Closed nhymxu closed 9 years ago

nhymxu commented 9 years ago

How to using module generate by gii? I try generate on yii2basic gii Copy to frontend/modules/test folder add config to frontend/config/main.php

'modules' => [
    'site' => [
        'class' => 'vova07\site\Module'
    ],
    'blogs' => [
        'controllerNamespace' => 'vova07\blogs\controllers\frontend'
    ],
    'test' => [
        'class' => 'app\frontend\modules\test\Module',
    ],
],

but try run yii.nx/test/ then not work. Write same on yii2 basic work well?

vova07 commented 9 years ago

First off all you need to fix your module namespace, to: frontend\modules\test\Module . Remember that in advanced and start templates doesn't exist app namespace. After, you must add to your frontend/config/mai.php config, the URL rules for your new module. Something like this:

'<_c>/<_a>' => '<_c>/<_a>',
'<_m>/<_c>/<_a>' => '<_m>/<_c>/<_a>'

See also this issue. And finally you'll can run your module on this url: yii.nx/test/default/index/. The / at the end is required.

nhymxu commented 9 years ago

thank for your reply. I try with "namespace app\modules\thutest;"

add "'thutest' => 'thutest/default/index'," to urlManager and it's work. I will try your rule.

Thanks you