@@ -1,5 +1,5 @@ | |||||
<?php | <?php | ||||
require_once ("include/config.php"); | |||||
require_once ("config.php"); | |||||
require_once ("phpcoord.php"); | require_once ("phpcoord.php"); | ||||
$api = new api; | $api = new api; | ||||
@@ -15,8 +15,12 @@ class api { | |||||
//Constructor | //Constructor | ||||
function api() { | function api() { | ||||
$this->setup(); | |||||
$this->bind(); | |||||
if (isset($_GET['howto'])){ | |||||
$this->howto(); | |||||
} else { | |||||
$this->setup(); | |||||
$this->bind(); | |||||
} | |||||
} | } | ||||
//setup | //setup | ||||
@@ -72,6 +76,20 @@ class api { | |||||
} | } | ||||
//howto | |||||
function howto() { | |||||
$form_action = $_SERVER['PHP_SELF']; | |||||
$smarty = new Smarty; | |||||
$smarty->force_compile = true; | |||||
$smarty->compile_dir = SMARTY_COMPILE_DIRECTORY; | |||||
$smarty->assign("page_title","API HOWTO"); | |||||
$smarty->assign("menu_item","api"); | |||||
$smarty->display('apihowto.tpl'); | |||||
} | |||||
} | } | ||||
@@ -0,0 +1,22 @@ | |||||
{include file="header.tpl"} | |||||
<dl class="faq"> | |||||
<dt>PlanningAlerts.com API</dt> | |||||
<dd> | |||||
Planning application data is available programmatically as <a href="http://georss.org/">GeoRSS feeds</a>. GeoRSS can be used in most all web mapping APIs and desktop GIS software, and in services like <a href="http://mapufacture.com">mapufacture</a> and <a href="http://pipes.yahoo.com/">Yahoo Pipes</a>. | |||||
<p/> | |||||
Construct an api request as follows. | |||||
Either lat/lng or postcode is required. area_size is always required.<br> | |||||
<p/> | |||||
<code> | |||||
http://www.planningalerts.com/api.php?<br> | |||||
lat=[some latitude]<br> | |||||
&lng=[some longitude]<br> | |||||
&postcode=[some postcode]<br> | |||||
&area_size=['s' 'm' or 'l'] | |||||
</code> | |||||
<p/> | |||||
<a href="http://www.planningalerts.com/api.php?lat=51.52277&lng=-0.067281&area_size=l">an example query</a> | |||||
</dd> | |||||
</dl> | |||||
{include file="footer.tpl"} |
@@ -19,6 +19,8 @@ | |||||
<div id="divMenu"> | <div id="divMenu"> | ||||
<ul class="collapse"> | <ul class="collapse"> | ||||
<li {if $menu_item =="about"}class="selected"{/if}><a href="about.php">About</a></li> | <li {if $menu_item =="about"}class="selected"{/if}><a href="about.php">About</a></li> | ||||
<li {if $menu_item == "api"}class="selected"{/if}><a href="api.php?howto">API</a></li> | |||||
<li {if $menu_item =="getinvolved"}class="selected"{/if}><a href="getinvolved.php">Get involved</a></li> | <li {if $menu_item =="getinvolved"}class="selected"{/if}><a href="getinvolved.php">Get involved</a></li> | ||||
<li {if $menu_item =="faq"}class="selected"{/if}><a href="faq.php"><acronym title="Frequently asked questions">FAQ</acronym>s</a></li> | <li {if $menu_item =="faq"}class="selected"{/if}><a href="faq.php"><acronym title="Frequently asked questions">FAQ</acronym>s</a></li> | ||||
<li {if $menu_item =="signup"}class="selected"{/if}><a href="/">Signup</a></li> | <li {if $menu_item =="signup"}class="selected"{/if}><a href="/">Signup</a></li> | ||||
@@ -34,4 +36,4 @@ | |||||
<div id="divWarning" {if $warnings == ""}class="hide"{/if}> | <div id="divWarning" {if $warnings == ""}class="hide"{/if}> | ||||
{$warnings} | {$warnings} | ||||
</div> | </div> | ||||