Best way to let users choose country/language when submiting an URL to a directory
Posted
by
Claudiu
on Pro Webmasters
See other posts from Pro Webmasters
or by Claudiu
Published on 2010-10-25T01:48:13Z
Indexed on
2011/11/19
10:16 UTC
Read the original article
Hit count: 310
I want to offer the user the possibility to add the country/language for websites they would submit to a fairly simple website directory. I have a folder with flags from http://www.famfamfam.com/lab/icons/flags/ . The flag images are named according to the ISO 3166-1 alpha-2 country codes, meaning that I could make a PHP script that would be able to retrieve images and the name of the country retrieved from the image name (not the full name, but it wouldn't be necessary).
Just to make things clearer, I couldn't find a proper combo-box jQuery plugin for my needs (that would act exactly like the native but with an icon before the text) and don't really have the time to develop one on my own. Considering the number of images, I also wouldn't just display them all with a radio box near them. Also, having a classic drop-down list would be a nightmare for me as I would have to assign the short country name manually to each entry, or do it once for every country. Offering the user a dropdown list with the short country names but no flag near them would also be unfriendly and confusing.
The idea is that every website featured in the directory would have the country flag icon near it. I have the images named properly but I don't know how to let the user choose the right image for their website. Any idees?
Thank you all in advance!
EDIT
Temporary solution is this file: http://www.andrewpatton.com/countrylist.csv It contains a list of countries including various other info, like the short country name, the same name that's used for the flag images. I can take that information and have a classic like this:
<select name="countries">
<option value="ro">Romania</option>
<option value="ie">Ireland</option>
<!-- and so on -->
</select>
Still, If anybody has a better idea...
© Pro Webmasters or respective owner