Seo Url By Title


I want to use the pages title to generate seo url link.

But the title may has spaces, & and other special characters and I want to replaced by "-" (according to seo url rules)

Is there function/or method in Yii to make that or I should write my own php function ?


did you tried to search it? there is a lot of ready manuals, forum posts and extensions:

Yes I had found a few extensions but I want use native Yii function

Nevermind I have wrote my own function that is like with yiibehaviorsluggable functionality

Thanks :)

there is no ‘built-in’ slug functionality because Yii is not just CMS system. However it is very easy to achieve this with extensions or with own coding, like in this manual:

Thank you Redguy for your suggestion.

I know the Yii is not another CMS. I used CMS before turn to the Yii framework :)

I would like to generate automatically the url by title rather than to store by use title/content/meta tags/etc … and one more field? the url path! (to many fields for one article!)

So the way I preferred was to generate the url by title replace spaces, & . and other special characters by ‘-’ plus id of content

Then I manipulate the url in action of controller and check only for id, loading the appropriate model and everything works! :)