![]() |
||
Documentation: Using PHPGeocache
Welcome to the documentation for PHPGeocache.
This page lists all available methods of the different classes this package is comprised of together with a simple example showing how to use it. 1. Installing PHPGeocacheAfter downloading the latest version simply extract the directory PHPGeocache contained into your document root or into a directory included in the include_path.This is how your document root may look before
[htdocs]
|- [images] |- [scripts] |- [includes] ... Extract the file so that the directory PHPGeocache with all files and directories contained therein is placed under the document root. This is how your document root may look after unpacking the content
[htdocs]
|- [images] |- [scripts] |- [includes] |- [PHPGeocache] |--- PHPGeocache.inc.php |--- Geocache.inc.php |--- Waypoint.inc.php |--- OCFParser.inc.php |--- db-mysql.inc.php |--- [demo] |--- [sql] ... 2. Database SetupPHPGeocache currently support MySQL only, however an adaption to other databases should be quite simple. You can also use PHPGeocache if you do not have a database by using only the classes Geocache and Waypoint. To use the database functions you first have to setup the database.
3. Using PHPGeocachePHPGeocache contains of several classes most of which can also be used without any of the others. Here is a quick information on the files and their implied use.
Example
<?php
define("PHPGEOCACHE_DB_TYPE", "mysql"); define("PHPGEOCACHE_DB_SERVER", "localhost"); define("PHPGEOCACHE_DB_DB", "phpgeocache"); define("PHPGEOCACHE_DB_USER", "root"); define("PHPGEOCACHE_DB_PASSWORD", ""); require_once "PHPGeocache/PHPGeocache.inc.php"; $phpgc=&new PHPGeocache(); $cache=$phpgc->getCacheByID(1); echo $cache->name." ".$cache->title; ?> As stated before currently only MySQL is supported so setting the PHPGEOCACHE_DB_TYPE to anything else than MySQL will not work. If you wish to support other databases you simply have to create a new file named "db-$DBTYPE.inc.php" in the PHPGeocache directory where $DBTYPE is the value of PHPGEOCACHE_DB_TYPE you would like to use. If you would like to use SQLite your file would probably be named "db-sqlite.inc.php". You then have to define a class named GeocacheDB in the file containing all the functions listed in db-mysql.inc.php with their correct implementation to be used for that specific database. Classes and ObjectsThe PHPGeocache class implements several functions regarding geocache handling. The Geocache class simply encapsulates a single geocache and is used by the PHPGeocache class internally. The Waypoint class is used by the Geocache class internally and represents a single waypoint.
PHPGeocache class documentation »
Geocache class documentation » Waypoint class documentation » GeocacheDB class documentation » Google Maps API Mashup documentation » |
||
