T
T
tempick2018-07-19 19:09:24
Yii
tempick, 2018-07-19 19:09:24

How to set up routing for viewing ads?

Hello! The point is this: there is a page on which ads are displayed. Clicking on an ad will take you to its preview. Each ad has its own id in the database. It is necessary that when following the link localhost/message/XXXX (XXX - ad id), the actionAdvertView method is called, and in it to get this same id in order to get the ad from the database. How to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2018-07-23
@tempick

If I understood everything correctly, then your task can be solved by adding the following rule to the URL manager:
'message/<id:\d+>' => 'message/advert-view'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question