PHP Classes
elePHPant
Icontem

Cities and zip codes: Lookup for cities and zip codes using AJAX

Recommend this page to a friend!
  Info   View files View files (31)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2006-10-17 (10 years ago) RSS 2.0 feedStarStarStarStar 67%Total: 5,410 All time: 438 This week: 1,042Down
Version License Categories
ocities 1.0.0Free for non-comm...Geography, AJAX
Description Author

This package can be used to lookup for cities and the respective zip codes.

It uses AJAX to search a file database with cities and the respective zip codes using just the first few letters of the city that the user types in a form text input.

The class can submit an AJAX request to find the cities that match the typed letters and display the city names without reloading the whole page.

It can also search for zip codes if the user types the first numbers of the zip code to search.

The listing that is displayed may be sorted by city name or zip code.

The example uses a file database with French cities but it may be replaced by another file with city and zip code information of anywhere in the world.

ADDITION : I put 2 versions :
'villes_normal/' folder is the old version
'villes/' folder is the new version, with Phonex and Soundex searches and sorting added

Picture of Johan Barbier
Name: Johan Barbier <contact>
Classes: 17 packages by
Country: France France
Innovation award
Innovation award
Nominee: 6x

Details
[PHP5] && [PHP4]
This script is used to look for cities and zip codes, via xmlhttp request.

It is very simple :
If you input letters, the script will look for all the cities  and their zip code 
with a name beginning by these letters, and display them. Same stuff if you input 
numbers : the script will look for cities whose zip code begins with these numbers.

You can sort the list displayed, ordering them by the names, or the zip codes.

A joker is available : *
Use it to display ALL the cities (beware, it can take a loooong time...there are currently 
40000 cities in the data file).

Currently, the data file only contains all the French cities.
You can change the data file when you call the constructor of the 'ocity' class.
Data must be formatted that way :

city \tab||several_spaces zip_code\endline
city \tab||several_spaces zip_code\endline
city \tab||several_spaces zip_code\endline
...and so on
  Files folder image Files  
File Role Description
Files folder imagecss (1 file)
Files folder imagedocs (1 directory)
Files folder imagevilles (2 files, 2 directories)
Files folder imagevilles_normal (1 file, 2 directories)
Accessible without login Plain text file readme.txt Doc. Readme file

  Files folder image Files  /  css  
File Role Description
  Accessible without login Plain text file maindoc.css Data css for documentation

  Files folder image Files  /  docs  
File Role Description
Files folder imageenglish (1 file, 1 directory)

  Files folder image Files  /  docs  /  english  
File Role Description
Files folder imageclasses (1 directory)
  HTML file index.html Doc. Index doc page

  Files folder image Files  /  docs  /  english  /  classes  
File Role Description
Files folder imagecity (1 file, 2 directories)

  Files folder image Files  /  docs  /  english  /  classes  /  city  
File Role Description
Files folder imageoajax (5 files)
Files folder imageocity (7 files)
  HTML file index.html Doc. Index doc page for the package

  Files folder image Files  /  docs  /  english  /  classes  /  city  /  oajax  
File Role Description
  HTML file buildAjax.html Doc. Doc
  HTML file class_oajax.html Doc. Doc
  HTML file search.html Doc. doc
  HTML file setFooter.html Class doc
  HTML file setHeader.html Doc. doc

  Files folder image Files  /  docs  /  english  /  classes  /  city  /  ocity  
File Role Description
  HTML file aVilles.html Doc. doc
  HTML file class_ocity.html Doc. doc
  HTML file getFirst.html Doc. doc
  HTML file getSearch.html Doc. doc
  HTML file sResult.html Doc. doc
  HTML file sSearch.html Doc. doc
  HTML file __construct.html Doc. doc

  Files folder image Files  /  villes  
File Role Description
Files folder imagephp4 (4 files)
Files folder imagephp5 (4 files)
  Accessible without login Plain text file data.dat Data Data file
  Accessible without login Plain text file index.php Example Index example page

  Files folder image Files  /  villes  /  php4  
File Role Description
  Accessible without login Plain text file oajax.cls.php Class PHP4 oajax class
  Accessible without login Plain text file ocity.cls.php Class PHP4 ocity class
  Accessible without login Plain text file phonex.cls.php Class Phonex class
  Accessible without login Plain text file soundex2.cls.php Class Soundex2 class

  Files folder image Files  /  villes  /  php5  
File Role Description
  Accessible without login Plain text file oajax.cls.php Class PHP5 oajax class
  Accessible without login Plain text file ocity.cls.php Class PHP5 ocity class
  Accessible without login Plain text file phonex.cls.php Class Phonex class
  Plain text file soundex2.cls.php Class Soundex2 class

  Files folder image Files  /  villes_normal  
File Role Description
Files folder imagephp4 (2 files)
Files folder imagephp5 (2 files)
  Plain text file index.php Example index page example

  Files folder image Files  /  villes_normal  /  php4  
File Role Description
  Plain text file oajax.cls.php Class Ajax class
  Plain text file ocity.cls.php Class ocity class

  Files folder image Files  /  villes_normal  /  php5  
File Role Description
  Plain text file oajax.cls.php Class Oajax class
  Plain text file ocity.cls.php Class Ocity class

Downloadocities-2006-10-17.zip 124KB
Downloadocities-2006-10-17.tar.gz 102KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Soundex 2 Download .zip .tar.gz To use the new search features Conditional
 Version Control Unique User Downloads Download Rankings  
 0%
Total:5,410
This week:0
All time:438
This week:1,042Down
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:87%StarStarStarStarStar
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:491
 
Awesome I like very much :)
8 years ago (Nino Paolo Amarillento)
80%StarStarStarStarStar