File: manual.txt

Recommend this page to a friend!
  Classes of Dave Smith  >  PHP Address Formatter  >  manual.txt  >  Download  
File: manual.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: PHP Address Formatter
Format postal address according to country rules
Author: By
Last change:
Date: 6 years ago
Size: 2,297 bytes
 

Contents

Class file image Download
Class: addrformat
Version: 1.0 4/15/2015

Copyright 2015 Wagon Trader, All Rights Reserved


Description:

This class will format a mailing and waypoint address for a given nation.


Files:

addrformat.class.php - Main class

example.php - Example usage script

example_cascade.php - Example creating a cascading selects for the location

/formats folder - Address format definition files


Installation:

Upload files to a web accessible location on your server (eg. public_html)


Configuration:

The class if configured to work with most server configurations. You can change the following settings in the class should you need to...

$formatFolder - You may specify the folder containing the format definition files, set to 'formats' by default.


Usage:

The included example.php file includes examples on instantiating the class and basic operation instructions.

The class will take an array of common address elements and using the provided nation abbreviation, use the matching definition file to format a full mailing and waypoint address.

Conventions and usage of format definition files.

Naming the files - Full address files are named [nation abbreviation].txt and waypoint files are named [nation abbreviation]_1.txt where the nation abbreviation is the supplied abbreviation for that specific nation.

Replacement tags will be contained in brackets and must match the tags assigned in the class. By default we are defining the following tags:

	[recipient] = The recipients full name
	[addr_num] = Address number (123)
	[building] = Building name (Empire State Bldg)
	[street] = Full street name (Main St.)
	[unit] = Suite, Apt, Unit number (Apt. 2B)
	[locality] = Locality, City name (Boston)
	[province] = Province, State name (Massachusetts)
	[province_abbr] = Province Abbreviation (MA)
	[postcode] = Postal/Zip code (02130)
	[nation] = Nation, Country name (United States of American)
	[nation_abbr] = Nation Abbreviation (US) - Use this for naming the format definition files.

Waypoint addresses are one line addresses which can be used by mapping services to determine a locations position on a map.


Creating your own script

Refer to class and provided example scripts for instructions on using methods

For more information send a message to info at phpclasses dot org.