M
M
m4son2021-10-21 16:03:21
Yii
m4son, 2021-10-21 16:03:21

How to create a component or module in yii??

We were given the task of creating a component (as I understand it) in a ready-made module on the yii framework.
There is a similar one located in /common/modules/worker/components/list1 . I need list2 and modify it a bit.
I copied it and replaced list1 with list2 everywhere. But when following a link similar to list1, it gives a 404 error.

Where to look? Where else do you need to write?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2021-10-21
@m4son

1. Add a module according to the documentation .
2. Set up routing.

'<_m:[\w\-]+>' => '<_m>/default/index',
    '<_m:[\w\-]+>/id<id:\d+>' => '<_m>/default/view',
    '<_m:[\w\-]+>/<id:\d+>/<_a:[\w-]+>' => '<_m>/default/<_a>',
    '<_m:[\w\-]+>/<_c:[\w\-]+>' => '<_m>/<_c>/index',
    '<_m:[\w\-]+>/<_c:[\w\-]+>/id<id:\d+>' => '<_m>/<_c>/view',
    '<_m:[\w\-]+>/<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_m>/<_c>/<_a>',
    '<_m:[\w\-]+>/<_c:[\w\-]+>/<_a:[\w-]+>' => '<_m>/<_c>/<_a>',

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question