friendly urls with yii history.js -
currently when using history.js in view url looks this
http://localhost/dev/clubs/
when sort or go next page adds modulesname
, clubs
, relationtable
url
http://localhost/dev/modulesname/clubs/index/?clubs_sort=relationtable.make.desc&page=2
how make nicer? maybe (without /index/ too)
http://localhost/dev/clubs/?sort=make.desc&page=2
currently in modules controller have this
public function actionindex() { $dataprovider=new cactivedataprovider('clubs', array( 'criteria' => array( 'with' =>'make', ), 'sort'=>array( 'defaultorder'=>'make.make asc', 'attributes'=>array( 'make.make'=>array( 'asc'=>'make.make', 'desc'=>'make.make desc', ) ) ), //for friendly url when history,js enabled 'pagination'=>array( 'pagevar'=>'page' ) )); $this->render('index',array( 'dataprovider'=>$dataprovider, )); }
and in url manager have this
'<action:(clubs|finance)>' => 'modulesname/<action>',
any idea how fix this? thanks
you can use url manager in config
'urlmanager' => array( 'urlformat' => 'path', 'showscriptname' => false, 'rules' => array( 'mypagename' => 'modulename/controllername/actionname' //any number of url's can changed here , no js needed ) ),
here can give name page name , many url's like
Comments
Post a Comment