Yii Framework Forum: Extend the CUrlManager - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Extend the CUrlManager How? Rate Topic: -----

#1 User is offline   Giacomo79 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-September 11

Posted 24 September 2011 - 11:12 AM

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.
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 24 September 2011 - 01:14 PM

Check this similar thread - http://www.yiiframew...p?/topic/13707-
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   Matt Kelliher 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 12-February 10
  • Location:Tampa, FL

Posted 24 September 2011 - 01:16 PM

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',
        ),
      ),
    ),
  ),

0

#4 User is offline   Giacomo79 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-September 11

Posted 24 September 2011 - 01:29 PM

Thanks to both, I got it. =)
0

#5 User is offline   befi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 10-March 11

Posted 05 June 2013 - 04:58 AM

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(...

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users