Answer the question
In order to leave comments, you need to log in
How to make a correct call to a Yii module?
Yii2 basic hosting. I'm doing all this for the first time, do not throw slippers. To create an admin panel, I use the approach with creating the admin module. Since I have 2 basic models, I generated the corresponding models for the module using Gii 2 (otherwise the controller was not created, since the models are related), the same controller and views.
Logically, the admin panel should open at: mydomain/modules/admin/module.php?r=book/index
, where book is my model and the BookController corresponding to it, and index is the corresponding actiotn.
And when you try to access the default controller: mydomain/modules/admin/module.php?r=default/index
, where default is the default controller created in Gii and its actionIndex, respectively, it should write me:This is the view content for action и бла-бла-бла
But when I try to access book/index, I get the same view as it was for the base book model, and when I access default/index I get Not Found (#404 O_o I
rechecked the connection of the namespace, everything seems to be correct everywhere. Someone had something Is there something like this and do you have any idea where the problem could be?
Answer the question
In order to leave comments, you need to log in
Connect the module admin
in the config
Open the page:
Yii2 is made so that by default it works with any web server setting, while Symphony / Laravel requires hard - availability single point of entry. Because Yii2 is not sure about setting up a single entry point without a flag - it itself strictly lets routing to the entry point with the route parameter on the index.php entry point index.php?r=admin/default/index
In general, the folder modules
should be outside the server, and the server itself should look in the folder web
, and not in the root of the site , this is what all frameworks have to do with it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question