Yii Framework Forum: Rename defaultController to defaultRoute (CWebApplication) - Yii Framework Forum

Jump to content

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

Rename defaultController to defaultRoute (CWebApplication)

#1 User is offline   napeHeK 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 04-March 10

Posted 07 October 2011 - 06:01 PM

I set the default module in config...
'modules' => array('someModule'),
'defaultController' => 'someModule', //wtf?..sorry)

0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 07 October 2011 - 08:11 PM

Er, wut?

Controller doesn't really map one to one for routes.

I am not sure if you understand what the question is, to be honest.

You haven't set any 'default module'.
You have declared a module, and then you are trying to set a default controller and it should look like this:
'someModule/someController' if you want a controller for 'someModule' to be the default.
"Less noise - more signal"
0

#3 User is offline   creocoder 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 198
  • Joined: 09-March 09
  • Location:*.php

Posted 23 October 2011 - 12:15 PM

Renaming defaultController to defaultRoute is a good idea. But not because:

Quote

'modules' => array('someModule'),
'defaultController' => 'someModule', //wtf?..sorry)

And because this is really the route you specify the full. For example:
'defaultController'=>'task/list'

'defaultController'=>'module/controller/action'


In general, it would be great if it were a new functionality to define default params. For example:
'defaultRoute'=>array('page/view','id'=>'about'),

No good, no bad, only consequence.
0

#4 User is offline   napeHeK 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 04-March 10

Posted 27 October 2011 - 02:14 PM

Maybe this is better,
'defaultRoute'=>array('page/view','id'=>'about'),


But I do so...
class PageController extends CController
{
    public function actionView($id = null)
    {
       if($id === null)
           $id = 'about';

       //...
    }
}

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