For my model manipulation I’ve used default set of controller+views generated with Gii and the only thing I changed was to move this set into module (or a submodule called “offers” of main module called “admin”, to be precisely) and some strings changes. Nothing else.
Therefore code generated by Gii for menu of particular view is left untouched, like this:
$this->menu=array
(
array('label'=>'List', 'url'=>array('index')),
array('label'=>'New', 'url'=>array('create')),
array('label'=>'View', 'url'=>array('view', 'id'=>$model->id)),
array
(
'label'=>'Delete',
'url'=>'#', 'linkOptions'=>array
(
'submit'=>array('delete', 'id'=>$model->id),
'confirm'=>'Pretty sure, you want to delete item of ID = '.$model->id.'?',
'style'=>'color: red',
)
),
);
Today I noticed that a very strange URLs are being generated for my view and delete operations. Even if both has the same construction and are as easy as can be (module/controller/view and model’s ID) I’m getting no ID at all in first example and a hash (#) sign in place of ID for second one. For view it is:
I don’t see, how urlManager settings could affect this as: I haven’t changed them a bit, since initial creation of website, because I have no bloody idea, how this works (I’m a total ignorant on regular expressions)! :] I would rather look for a source of this problem in a fact that this is module inside module inside core application.
as for the other problem, be sure that "$model->id" is set
also try to change your rules for the following
'rules'=>array
(
'<controller:\w+>/<action:(\w|\.)+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
//since your urlFormat is path theres no need for the next line
//'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
Its better to change the urlFormat to get and keep the 3rd line of the rules for a better looking
I do want addresses like you show in second example (with ?var=1), and since this line is not necessary for this purpose, I’ll remove it. Thanks for reporting this, and as I can see I’m a really urlManager newbie! :]