Hi,
I can’t find CBaseUrlRule.php in the yii-1.1.10.r3566.zip file, please add it.
Hi,
I can’t find CBaseUrlRule.php in the yii-1.1.10.r3566.zip file, please add it.
Again… check the documentation for CBaseUrlRule - http://www.yiiframework.com/doc/api/1.1/CBaseUrlRule
Under the "source code" is the path to the file where this class is located…
spoiler: some of the Yii clases are not in a separate file but are grouped together in an another component file.
i’m trying to install an extension (urlrouter), i placed it under components.
The class starts by:
class UrlRouter extends CBaseUrlRule {
...
But Yii says :
Why do you need to extend that class… note that this is an abstract class - http://php.net/manual/en/language.oop5.abstract.php
I don’t made the “urlrouter” extension, i’m just trying to include it.
This is because Yii does not know that CBaseUrlRule does not have an own file.
Try this:
Yii::import('system.web.CUrlManager');
class UrlRouter extends CBaseUrlRule {
...
I added it to the "import" array :
'import' => array(
'application.models.*',
'application.components.*',
'application.extensions.jtogglecolumn.*',
'system.web.CUrlManager',
same error:
sorry, second parameter of import has to be true to force include:
Yii::import('system.web.CUrlManager', true);
class UrlRouter extends CBaseUrlRule {
...
This is not possible with import configuration, you have to do it in the file where you declare your class.
Ok, fine, but this extension has too many errors, i think i’ll leave it.
I get errors like :
and
It looks like you try to use CBaseUrl/CUrlRule rule as a CUrlManager? That won’t work.
What do you want to do? Replace the CUrlManager OR have a custom url rule as explained here?
For the first you simply extend from CUrlManager and not from CBaseUrlRule/CUrlRule.
For the latter you should extend from CUrlRule and not from CBaseUrlRule.
is it a fake extension ? (only 1 file, take a look) :
The extension name is a little missleading since it’s named “urlrouter” which implies it’s an UrlManager replacement, but it’s just an UrlRule. So according to your comments on the extension page, you have a wrong config.
It should be like this:
'urlManager' => array(
'rules' => array(
array
(
'class' => 'application.components.UrlRouter',
)
),
),
I’ve downloaded UrlRouter2.zip, it looks ok to me.
ah OK !
Thanks for the check !
@Y!! :
Today i tried the config but the urlrouter class does not take effect, here is my config:
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'class' => 'application.components.UrlRouter'
),
),
I also tried:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
array(
'class'=>'application.components.UrlRouter',
),
),
),
It gives the same result as:
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
),
),
Please make a try
I don’t use this extension. I can only point you to the description that says:
If you can’t get it to work, you may ask the author directly via private message.
Finally i reviewed a wiki that helped me to know more things about default Yii rules:
'rules'=>array(
'<controller:\w+>'=>'<controller>/list',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'<controller:\w+>/<id:\d+>/<custom_title>'=>'<controller>/view',
In the 3rd line, instead of <custom_title> i lost a lot of time because i tried to do it with reg expressions like :
‘<controller:\w+>/<id:\d+>/.+’=>’<controller>/view’,
And Yii had created urls like :
localhost/post/33-how-about-you/.
then i tried to switch to that useless extension
So how did you solve it?
I wanted to remove the ‘default’ controller when accessing a module.
for example:
from: route/module/default/actionID
to: route/module/actionID
Can anyone solve this?
What did you expect instead? Looks okay for me… And why do you try that extension for things you could achive with yii itself?
'module/<action:\w+>'=>'module/default/<action>',
Is this what you want?