Welcome Guest, Not a member yet? Register   Sign In
area.example.com - How to do Subdomains for Location-Based Database Filtering?
#1

[eluser]Nalorin[/eluser]
Hey All,

I'm new to CI and have gone through most of the CI video tutorials on the NetTuts website to familiarize myself somewhat with the framework.

Currently, I'm working on developing my own website that delivers location-based content to users. I need the content to be filtered similar to eBay Classifieds / Kijiji, where users will be directed to the area (subdomain) nearest them, after selecting their location.

I read the thread: How to manage subdomains? and it seems like this solution could work for me but, being new to CI, I'm not really sure about the implementation of such a solution, or if it would be better to use hooks or something?

---

An example of what I want to do:

User:
- id
- name
- etc

Fruit:
- id
- location (eg. "chicago.il.usa", or "toronto.on.ca")
- type
- etc

Vegetable:
- id
- location
- type
- etc

User selects Joliet, IL. They're redirected to chicago.il.example.com, showing them all the fruits available in the greater Chicago Area in which they reside.

I can handle the database work - I just want to know how (or where) would I implement getting "chicago.il" from the URL so that I can use it in my SQL query?

In the example above, browsing Fruits and Vegetables would be different pages of the site, with each pointing to yourArea.state.example.com/page, just like browsing Houses or Cars would be different on a classified website.

---

Another question I'm not too sure about is:

Would it be better (for performance) to make a "fruit" table for each area (chicagoFruit, torontoFruit), or to stick with a single "fruit" table and use url-style locations with "where location like 'chicago.il%'"?

I am expecting up to about 20,000 records in the database at any given time and site traffic of around 150K hits/day


Messages In This Thread
area.example.com - How to do Subdomains for Location-Based Database Filtering? - by El Forum - 08-10-2010, 03:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB