Topic: URL and Code Reuse
I am trying to build something similar to craigslist but, being a novice, has some simple questions. I use one table for each city to hold the ads. I have written basic code for one city and it works. But, now I can use only one city "phoenix" as I store all Phoenix ads in this table. But, what is the easy way to do this for other cities like Chicago, Miami etc? My idea for now is to create a new model for each city and may be I can try to reuse the code from Phoenix. If you have better ideas, please suggest me.
Also, now phoenix ad system works at this url hxxp://hostname.com/phoenix. How do I change it to work like craigslist? I mean like hxxp://phoenix.hostname.com, hxxp://chicago.hostname.com and so on.
Appreciate if you can help me out.