php - How to create URLs without parameter names in Yii? -


i'm using cgridview display data table:

/application/protected/views/foo/bar.php

$this->widget('zii.widgets.grid.cgridview', array(     'id' => 'my-grid',     'dataprovider' => $dataprovider,     'filter' => $model,     'columns' => array(         'myid',         ...         array(             'class' => 'cbuttoncolumn',         ),     ), )); 

that created table 3 links each row: view, update, , delete; e.g. (for view): /index.php/foo/123, 123 id (or primary key value) of element.

now want modify widget call, in order different buttons links /index.php/bar/123:

$this->widget('zii.widgets.grid.cgridview', array(     'id'=>'my-grid',     'dataprovider' => $dataprovider,     'filter' => $model,     'columns' => array(         'myid',         ...         array(             'class' => 'cbuttoncolumn',             'template' => '{view}{update}{delete}',             'buttons' => array(                 'view' => array(                     'url' => 'yii::app()->createurl("bar", array("myid" => $data->myid))',                 )             ),         ),     ), )); 

the (view) link i'm getting looks this: /index.php/bar/myid/123 -- , request ends 404 error.

how build links without parameter name in url?


additional info -- routing configuration in /application/protected/config/main.php:

return array(     ...     'components'=>array(         ...         'urlmanager'=>array(             'urlformat'=>'path',             'rules'=>array(                 '<controller:\w+>/<id:\d+>'=>'<controller>/view',                 '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',                 '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',             ),         ),         ...     ), ); 

when have /index.php/bar/myid/123 url, actionview of barcontroller must have myid (not id) parameter. have actionview($id) , cause problem. need have actionview this:

public function actionview($myid) {     ... } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -