ivanishin
(Dima Zt)
1
I want to construct such URL as
site.com/expression/21.01.2011
expression - is static word (in russian language)
21.01.2011 - is date from database
My urlManager is
'expression/<date>'=>'controllerName/actionName'
Yii will parse the URL above, but how can I generate such URL using CHtml::link() or createUrl()?
Thank you.
gusnips
(Gustavo)
2
something like
$this->createurl('controllerName',array('date'=>'[i]21.01.2011[/i]'));
will do what you want
ivanishin
(Dima Zt)
3
well, actually I want to generate URL without controllerName in it, but with static expression. Dilemma.
gusnips
(Gustavo)
4
I see…could you gimme a couple of examples of the expressions you will use ?
ivanishin
(Dima Zt)
5
thank you for replies, here is existing url
билеты/Тестовый-артист-1/31.01.2011/Teßtischür-sall-1
where
билеты - is static word (means tickets)
Тестовый-артист-1 - (means actor’s name) taken from database
31.01.2011 - date, taken from db
Teßtischür-sall-1 - (concert hall name) taken from db
and my urlManager rules:
'билеты/<artist_seo_name>/<date>/<hall_seo_name>'=>'tickets/event'
where
'tickets/event'
is controllerName and actionName, you know
gusnips
(Gustavo)
6
To use it the way you want you must extend CUrlmanager
easier yet is to use this extension that seens to do exactly what you need
how can you retrieve <date> from Database?
sieppl
(Sebastian Kather)
8
Since Yii 1.1.8 you can build your own Url rule classes: http://www.yiiframework.com/doc/guide/1.1/en/topics.url#using-custom-url-rule-classes
There you can do anything you want.