Help With Urlmanager

A few questions from a complete noobie to YII and only marginally familiar with MVC architecture… I’ve gone through the screencasts and looking for more examples/tutorials.

Unfortunately, there are a few things I can’t figure out…

History: I’m moving a perl/mysql system using a custom data-store to a more standard relational model with a YII front-end.

The original developer put in some interesting logic when viewing a text area that I now either have to convert or mimic in the new system… Examples.

  • Putting in the text <table_x:meta_name> will create a link to the webroot/table_x/view/ for that record or list of records.

  • Putting the same into double brackets <<table_x:meta_name>> links to an attached file and will download it.

  • Putting in triple brackets <<< >>> will link to the record and attempt to display the attached file in-line.

I can’t seem to get a handle on the urlmanager module and need to make the links work. As an example, here’s what I need (I can’t include the full url since I’m new)


would link to the table_x table and show a single record with meta_name = xxx-xxxx-00 and meta_version = 2


would link to the table_x table and get a list of all versions of the record with meta_name xxx-xxxx-00

Any help would be much appreciated

Many thanks,


If you can build regexp for your urls then you can easily map urls to controllers and actions.


I had tried that with very limited success.

  • If I want to view a single record using the standard main.php that gii creates, I can do localhost:8888/ncs/index.php/fmo/view/id/2 and it works fine but isn’t what I’m after.

  • If I change the ID rule to ‘<controller:\w+>/<id:\d+>’=>’<controller>/admin’ and use the url localhost:8888/ncs/index.php/fmo/admin/id/2, it shows all records in the admin screen rather than just that of ID=2

  • If I add to the top of the rules “’<controller:\w+>/<meta_name:\w+>’=>’<controller>/view’,” and use localhost:8888/ncs/index.php/fmo/view/meta_name/test-01-01, it comes back with an error 400.

URL manager call looks like the following (although I’d like the top 2 conditions to show in the admin screen instead of view: