Recently i have added language parameter in my URL Rules and now they looks like this
'urlManager'=>array(
'showScriptName'=>false,
'caseSensitive'=>false,
'urlFormat'=>'path',
'rules'=>array(
'<lang:\w+>/<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<lang:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<lang:\w+>/<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
but the problem i am facing now is that i have to explicitly set action of views when i use id in my url…for example let me explain the situation
http://localhost/myweb/en/ProductApplications/view/0000000006
This url should also work as
http://localhost/myweb/en/ProductApplications/0000000006
since both are representing same url through the rules…both are working fine at this moment …
Now the problem comes when i create the url for suppose when i use CHtml::Link to generate url without the action presence as the second url then it does not work …here is my code
Yii::app()->createAbsoluteUrl( 'ProductApplications/' ,array( 'lang'=>Yii::app()->language,'id'=>3211));
the result of this above link generate a wrong link disintegrated like like below
http://localhost/myweb/ProductApplications/lang/en/id/3211
Suppose if i explicitly provide ‘view’ action along controller ‘productApplication’ then it works fine like below
Yii::app()->createAbsoluteUrl( 'ProductApplications/view' ,array( 'lang'=>Yii::app()->language,'id'=>3211));
// output http://localhost/myweb/en/ProductApplications/3211
The same issue is with using CHtml::Link , kindly suggest how can i make it correct so it will automatically detect when id is given then it could be either view or update…