Url Rewrite Method

Hi,

after a lot of searches I haven’t found what I’m looking for…

I would like to write a function to allow the url to be like this


http://example.com/category/name-of-the-post-ID.html



without storing the slug in database

so the most important thing of the URL is the id and if delete the slug it will search anyway the right post.

Ex.


http://example.com/category/nae-post-ID.html



The urlmanager rules should be like this:


category/<slug:[\w-]+>-<id:\d+>'=>array('post/index','caseSensitive'=>false),

But the createurl function?

because I use this:


 CHtml::link('View',array('post/index','category' => $a->category, 'slug' => $a->title,'id' => $a->id), array('class'=>'btn btn-primary btn-block')); ?>

But it write the url with slashes / not with -

so the output is


http://example.com/category/name-of-the-post/ID.html



thanks for help

it’s really not possibile to do this with yii?