Can Yii correctly utilize urlManager rules with the createUrl function?

I have a series of urlManager rules that simplify my web application. For example, the vanilla application installer that comes with Yii creates the 'page' model and I redirect pages from /site/page/view/about to /about.

This works great, but I am not sure if Yii is capable of reading my rules to determine the best URL to create. Currently, createUrl will return the standard URL (/site/page/view/about) if I use the following code: createUrl('/site/page', array('view'=>'about'))

Alternatively, using createUrl('/about') will link to the preferred URL correctly, but this does not seem as good practice as the first example. Also, using this in the CMenu function will not associate this link as the current active link.

Is there better practice to follow for this requirement? The alternative use of createUrl seems overly 'hard coded' and, as noted, doesn't work logically with the system (determining the active page, etc).


Your rule '<page:\w+>' => 'site/page/view/<page>' is incorrect. Use this (assuming you are using the default gii generated code) as the first rule


Use this way to create url: /site/page/view/about

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

It is mentioned in better way here : Yii Url Mmanagement

Need Your Help

SQL Server CE checksum changes on SELECT queries

c# .net sql-server-ce checksum

Why when I only do SELECT on a .sdf file, it's checksum changes ?

UDP receiving - precise time when packages arrive in C#

c# sockets udp timestamp udpclient

Is there way to know precise time when packages arrives to buffer with UDP protocol in C# (windows 7)?