Urlmanager - Grab Rules From Db Table

Hey everyone!

How can I grab urls for CUrlManager from db table?

What if I create a class "ExUrlManager extends CUrlManager" and do the following:


public function init()

{

   //prepare $rules;

   $this->rules = $rules;

   parent::init();

}

Would that be good?

To specify URL rules, we need to configure the rules property of the urlManager application component:




array(

    ......

    'components'=>array(

        ......

        'urlManager'=>array(

            'urlFormat'=>'path',

            'rules'=>array(

                'pattern1'=>'route1',

                'pattern2'=>'route2',

                'pattern3'=>'route3',

            ),

        ),

    ),

);



Or maybe you can try below page: using custom url rule :

http://www.yiiframework.com/doc/guide/1.1/en/topics.url#using-custom-url-rule-classes