please help about actionview

Hi All

please i need HELP FOR …

displaying page Name in the url instead of page ID

SO IT WILL BE

localhost/mysite/index.php/page/about

INSTEAD OF

localhost/mysite/index.php/page/1

i`m tired from edit actionview() but i don’t know how ??????

thanks

What should solve your problem is, when creating url for wanted page instead of:

$this->createUrl(‘page’, [‘id’=$model->id]);

U should create id like $this->createUrl(‘page’, [‘name’=>$model->name])

also change action in controlle to be

actionUpdate($name) {

here U should serach for $model based on ‘name’, not id

}

this solution assume that U have unique name column in DB settings

1 Like