Jump to content

Recommended Posts

Hello everyone,

 

I am a newbie in php and have made a couple of basic applications. Hence I needed some advise on my next project.

 

I am working on a classified ad site and needed some thought process on the different countries and cities concept.

 

Basically, I want to make the site load by country prefix. So for example if I type the url www.sitename.co.uk then it loads the site displaying only adverts listed in uk, and further most if someone changes the city to london, then the url location changes to london.sitename.co.uk and only lists adverts in London.

 

Similarly if the site name is www.sitename.com then it displays adverts listed in USA and the same concept as above for cities so newyork.sitename.com will display adverts in New York city.

 

Can someone share ideas on the best way to implement this feature.

 

Thanks,

Ket

When you call the page have it read the URL and match it against a database, and pull all the rows from the table matching the url column.  What I would do is have a table called adverts set up like so:

 

Table adverts:

ad_id

country

city

ad

 

From the URL  grab the .co.uk (or whatever) and match against country.  If there is something before sitname.co.uk (or whatever...ex: london.sitename.co.uk)  have it match both the country and the city.  From there just pull down information and print it out.

 

As far as file system goes,  you'll probably only have files that are basic templates, and the entire site ran as a backend.  For this, look into a framework.  I really like Cakephp.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.