Recent Changes - Search:

add Cookbook page

hide

Cookbook


hide

Topics


show

Changed

Visitor's book Site map pmwiki-2.2.127

NZ DoC

NZDoC version 2020-06-10

Summary: Use DoC API to retrieve campsites, huts, and tracks information to display in PmWiki
Version: 2020-06-10
Prerequisites: PmWiki 2.2.130 (PHP 7.4 compatible)
Status: Production
Maintainer: skiwi
Licence: GPL3[1]
Categories: Images Includes PHP74
Users: (view? / edit)
Discussion: NZDoC-Talk?

Questions answered by this recipe

How do I display information from New Zealand's Department of Conservation on campsites, huts, and tracks information on a PmWiki page?

Description

This recipe generates the markup for the display of Department of Conservation information

Installation

  • download 2020-06-10-nzdoc.php Δ
  • copy to the /cookbook/ directory as nzdoc.php
  • add to config.php the line
    include_once($FarmD/cookbook/nzdoc.php);

Usage

Place the directive, as described below, in your PmWiki page.

The recipe provides a page variable {$NZDoCVersion} which contains the current version, and $NZDoC for a (:if enabled NZDoC:) recipe installation check.

DoC regions

You have to ask to find these out

CODEREGION
NZ-NTLNorthland
NZ-AUKAuckland
NZ-WKOWaikato
DOC-CORCoromandel
NZ-BOPBay of Plenty
NZ-GISEast Coast
NZ-TKITaranaki
NZ-MWTManawatu/Whanganui
DOC-CNICentral North Island
NZ-HKBHawke's Bay
NZ-WGNWellington/Kapiti
DOC-WPAWairarapa
NZ-CITChatham Islands
NZ-NSNNelson/Tasman
NZ-MBHMarlborough
NZ-WTCWest Coast
NZ-CANCanterbury
NZ-OTAOtago
NZ-STLSouthland
DOC-FILFiordland

Configuration

(:nzdoc type=type

content=detail
id=identifier
height=pixels width=pixels float=left|right clear=both|right|left:)
  • type= -- hut, track, campsite
  • content= -- alert, detail, region, all, dump, check
  • id= -- id for hut, track, campsite, or region
  • clear= -- clear image to left, right, or both

Parameters are case-insensitive.

config.php settings

You can change the following in config.php. For example

$NZDoCAPIKey = 10; # key obtained from DoC API website
$NZDoCDebug = true; # results may vary

Styling output

Style the output using CSS. Add the css to local.css. To assist the following classes are applied

  • output is encapsulated by <div class='nzdoc':\>
  • tables are defined with <table class='nzdocdata'>
  • the following classes are used for data: nzdocalert, inspect the html output for other classes

API notes

The DoC API offering the following resources:

v2-huts [ Base URL: api.doc.govt.nz/v2 ]
/huts
[{assetId, name, status, region, lat, lon}]
/huts/alerts
[{assetId, name, alerts[{displayDate, heading, detail}]}]
Notes: detail has html formatting; displayDate is duplicated in text; Bug: URLS are not fully qualified;
/huts/{id}/alerts
[{assetId, name, alerts[{displayDate, heading, detail}]}]
/huts/{id}/detail
{assetId, name, locationString, numberOfBunks, facilities[], hutCategory, proximityToRoadEnd, bookable, introduction, introductionThumbnail, statitLink, region, place, status, lat, lon}
Notes: bookable is a boolean
v2-campsites [ Base URL: api.doc.govt.nz/v2 ]
/campsites
[{assetId, name, status, region, lat, lon}]
/campsites/alerts
[{assetId, name, alerts[{displayDate, heading, detail}]}]
/campsites/{id}/alerts
[{assetId, name, alerts[{displayDate, heading, detail}]}]
Notes: detail has html formatting; displayDate is duplicated in text; Bug: URLS are not fully qualified;
/campsites/{id}/detail
{assetId, name, locationString, introduction, introductionThumbnail, landscape[], campsiteCategory, access[]; facilities[], activities[], dogsAllowed, numberOfPoweredSites, numberOfUnpoweredSites, bookable, staticLink, region, place, status, lat, lon
Notes: bookable is a boolean
v1-tracks [ Base URL: api.doc.govt.nz/v1 ]
/tracks
/tracks/alerts
/tracks/region/{regionId}
/tracks/{id}/alerts
/tracks/{id}/detail

Change log / Release notes

2020-06-10 Initial version

See also

Contributors

Special thanks to

Comments

See discussion at NZDoC-Talk?

Page last modified on 2020 Jun 29 05:59

Edit - History - Recent Changes - WikiHelp - Search - DoC API -> mailto:?Subject=KiwiWiki: NZ Do C&Body=From KiwiWiki: NZ Do C (//kiwiwiki [period] co [period] nz/pmwiki/pmwiki [period] php/Cookbook/NZDoC) - Use [[https://api [period] doc [period] govt [period] nz/getting-started to retrieve campsites, huts, and tracks information to display in PmWiki|email page as link]]