Question

I have the following rule, in my config/main.php:

'<controller:\w+>/<action:\w+>/<param:\w+>'=>'<controller>/<action>',

Can I have in ExperienceController an action actionListByDistrict($param) that is called when the URL /mysite/experience/district/value is used?

I would like to do a kind of mapping in Yii Framework, but how? Actually the action takes this form: actionDistrict($param).

Était-ce utile?

La solution

The rule that I mention on the comment should work:

'experience/district/<param:\w+>'=>'experience/listByDistrict'

Make sure this specific rule stays on top, because the order on Yii UrlManager Rules matters.

About the general rule however, I don't see way for doing it atm.

:)

Autres conseils

You can try that 'experience/district/<id:\d+>'=>'experience/listByDistrict/',

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top