how to custom url on yii?

I am tried to custom url from localhost/?r=site/page&view=about to localhost/?ref=site/page&show=about

or localhost/?ref=site&action=page&show=about ( this will be greater )

I found how to change ‘r’ to ‘ref’ from yiiframework.com/doc/api/1.1/CUrlManager with routeVar

But can’t find to to change ‘view’ to ‘show’ or any other name.

anybody can told me how to working with custom url on Yii?

Try this page: http://www.yiiframework.com/doc/guide/1.1/en/topics.url#user-friendly-urls

It tells how to customize your URLs.

The CViewAction uses ‘view’ for the GET parameter by default. If you want to change that, you should extend the action and update the $viewParam property:




<?php

class MyViewAction extends CViewAction

{

    public $viewParam = 'show';

}

?>



Next, update your SiteController class:




public function actions()

    {

        return array(

            // ...

            'page' => array(

                // 'class' => 'CViewAction',

                'class' => 'MyViewAction',

            ),

        );

    }



Finally, update your views so that any url now uses ‘show’, instead of view:




// Change:

Yii::app()->createUrl('/site/page', array('view' => 'about'))


// To:

Yii::app()->createUrl('/site/page', array('show' => 'about'))



Or simply set the viewParam property of CViewAction:




public function actions()

{

    return array(

        'page' => array(

            'class' => 'CViewAction',

            'viewParam' => 'show',

        ),

    );

}



Cheers

Uhhhhh… or that yes… :unsure: