Search the Community
Showing results for tags 'urlmanager'.
So I'm just starting out with Yii and I'm trying to figure out the best way to organize my project. It's largely focused on being local, so I want to have different sections of the site for different cities. I have a city table in my database and I want to organize my URL as such: www.example.com/city-name. For example, if I want to show Chicago, it would be www.example.com/chicago. Right now I have a City controller and my cities are all attached to numeric id's. So my Chicago city (id = 1) URL reads as www.example.com/city/1. I want to get rid of my city controller name in the URL and use the name of the city instead of the id of the city in the URL. I'm assuming the answer lies in this part of the documentation (yes I've tried looking at the documentation): http://www.yiiframework.com/doc/guide/1.1/en/topics.url#using-custom-url-rule-classes - but I'm too new at Yii to decipher that code. First of all, is this the best way to organize my site and secondly, how do I get my URLs to look the way I want? Thanks so much - I've been struggling with this for a couple weeks. Sorry I'm a noob.