Create your Publisher Templates

Create your Publisher Templates

iShare Publisher allows you to perform on-line searches on any of your back office databases. The data from these databases is loaded into the iShare Maps database via ETL Spatial Data Transformation tasks. Internal Data Share Connections control how fields are used i.e. add any necessary hyperlinks or indexes for searching. They can then be displayed using the iShare Publisher Templates.

There are three main templates:

A template’s function is to generate html and to display data via Record Sets. An example of a record set might be the search results against a planning application dataset.

  • The search template may use Record Sets to populate drop-down options such as application type or ward

  • The results template will use Record Sets to display results from a search

  • The details template will use a Record Set typically with a single ‘feature’ such as an individual planning application

The following is a guide to creating your html pages to extract data from the iShare Maps database. Examples are used to demonstrate the functionality.

Calling a Template page

The template pages are all accessed through the publisher.aspx endpoint. Use a requestType of parseTemplate and specify the template name, which in the example below is DCSearch.tmplt to view the generated html. The template must exist in the templates folder under the webservice application folder.

https://<maps.mycouncil.gov.uk>/publisher.aspx?requestType=parseTemplate&template=DCSearch.tmplt

The Contents of a Template page

A template contains standard html content. Whenever data needs to be drawn from a Data Share Connection a Record Set is defined in the template. This might be a simple case of populating a drop down option on a form such as the example below. Or more advanced use might be to place conditional statements in the Record Set definition. See the Advanced Usage page for the full feature list of what is possible with Record Sets.

Record Sets

In the following code snippet from a template a Record Set is used to populate an option drop down element. The code starts with a RecordSetStart to define the Data Share Connection from where the data will come from. Each record in the Record Set is used to define an option element and then the code finishes with a RecordSetEnd to close out.

Syntax
##DataShare.ApplicationType.RecordSetStart## <option value="##Field.DCAPPTYP##">##Field.Description##</option> ##DataShare.ApplicationType.RecordSetEnd##

When the template is accessed, Publisher will retrieve all records from the ApplicationType Data Share Connection. The fields DCAPPTYP and Description will be taken from the returned dataset and the appropriate field tags substituted for this data.

Example
<option value="ID1">ID1 Description</option> <option value="ID2">ID2 Description</option> <option value="ID3">ID3 Description</option>