Extend the CUrlManager

Hi,

How can I extend the CUrlManager? I created the new class, but I don’t know where tell to Yii to use the new class. I remember in the config file, but I’m not sure.

Thanks.

Check this similar thread - http://www.yiiframew…p?/topic/13707-

You can tell it to use it in the components section of your main.php file:




  'components' => array(

    'urlManager'=>array(

      'urlFormat'=>'path',

      'rules'=>array(

        array(

          'class' => 'path.to.CustomUrlManager',

        ),

      ),

    ),

  ),



Thanks to both, I got it. =)

Matt’s code registers a custom URL rule class.

If you actually want to extend CUrlManager, use this:




'urlManager'=>array(

    'class'=>'path.to.MyCustomUrlManager',

    'urlFormat'=>'path',

    'rules'=>array(...