URL Management [SOLVED]

After read all the documentation and forum topics related to URL Management I can’t make what I want. I need simple url’s for

/section/title+of+section

In my view I have :

CHtml::link($seccion->nombre,Yii::app()->urlManager->createUrl(‘seccion/show’,array(‘title’=>$seccion->nombre)))

and I got

index.php/seccion/name+of+section

and this is the rule :

‘seccion/<title>’=>‘seccion/show’,

But when I clik I got error : "The requested seccion does not exist."

I don’t know what I’m doing bad, any help will be appreciated, thanks


'section/<title>'=>'seccion/show',

in your actionShow()-method your model will be loaded by title?

The pattern for title is missing. The rule should look like this for example:


'seccion/<title:.+>'=>'seccion/show',




Mike,

I don’t think that is necessary.

Hmm, i think so. From the API docs:

Official blog demo main configuration file, line 54:


'tag/<tag>'=>'post/list',

Right, just checked the implementation. So the API is a little incomplete here. The default pattern is [^\/]+ which means, any characters except /.

@ciudadredonda:

Sorry, so must be another problem.

I just issued a ticket to have API fixed.

@ciudadredonda,

Use mbi’s solution, and keep in my mind that using non-English variable names in source code always cause this kind of conflict. :)

thanks for all contributions, @mbi you put me on the right way.

I have to change actionShow() method to get the model by ‘title’.