Views Created By Gii Crud

Hello,

I don’t know if it is an expected behavior, but when I create a CRUD and locate the controller inside a module, views are created in the main app’s view folder, not in the module’s. Hence, when calling the controller, error arises since views are not found. You just have to move the views from the app/views folder to the module’s.

Is that the expected behavior?

Thanks

Pierre

Hello,

this held because when u r using gii module to create view then the path alias of view don’t specified in proper manner.

you have to give path of module directory for which u want to create view and also controller for that view.

so, this may be path issue in gii so check it out.

hope it works!

thanks

sprytechies

if you are using gii

then u can tell gii where you can want modules in backend or frontend in advance app

first create module example country

module class will be -backend\modules\country\country

module id-country

then make model

table name-country

model class-Country(it will come itself,if table is prsent)

it will create module folder country inside modules

then in namespace

backend\modules\country\models

it will create model inside country modules inside models folder

then goto crud

model class- backend\modules\country\models\Country

search model-backend\modules\country\models\CountrySearch

controller class-backend\modules\country\controllers\CountryController

and dont forget give module id -country

then it will create crud and controller with filters

then just if you want to give any link to ur modules then use below

<a href="<?php echo Url::toRoute(’/country/country’);?>">

it will redirect to your index file of country modules

Thank you both for your help.

My mistake was to not enter a module id, which indeed redirect view creation to the proper folder.

/p