The Template Parsing System


Basics
A template parsing system is a mechanism which separates HTML design elements from PHP code. With this framework, a web designer can create the locator interface with only knowledge of HTML, and not even have to worry about the PHP code which runs the application. This is not to say there are no rules to follow, but it does give a designer considerable freedom in creating an interface that matches the look and feel of their web site.

The basic idea is that the locator web page is broken down into one or more HTML design templates, where each template represents a smaller piece of the locator interface. When the locator page is viewed in a web browser, all the pieces are dynamically assembled and merged with information coming from the database. LiteRadius comes with all the templates needed to assemble the core locator interface. All you need to do is create a web page that will display the locator to your web site visitors.

NOTE: The LiteRadius XML Locator does NOT use a template parser. You may skip over this section if you are using the XML Locator.

Parsing Tags
Key to understanding parsers is the predominant use of template parsing tags. A parsing tag is nothing more than some text surrounded by curly brackets, like {TPL_MAIN}. If you inspect any of the web pages in the templates directory you will see many such parsing tags throughout the documents. Each parsing tag represents a place holder for some component of the locator interface. During the “parsing process”, LiteRadius will replace the parsing tags with other templates, or location data stored in the database.

From a web design standpoint, the quickest way to integrate LiteRadius into your web site would be to:

  1. Create a web page that will display the locator.
  2. Place the {TPL_MAIN} inside that page at the spot you want the locator to appear
  3. Specify the path (in Application Settings), where LiteRadius will find your locator page.
  4. Direct all locator navigation links in your web site to the master control script, locator.php


Sample Locator
LiteRadius comes with a sample locator page, golf_locator.htm, and its associated graphics, which can be found at root installation directory, lrx_x_x. If you inspect the html of the golf_locator.htm page, you will notice the main parsing tag {TPL_MAIN}.

The {TPL_MAIN} tag is the last step in a series of “parses” which occur when LiteRadius dynamically assembles the locator interface. Other components including input structures, graphics and data, are also parsed from the set of html sub-templates also found in the templates directory.

NOTE: Directly opening golf_locator.htm with your web browser will only display the main template page, not the locator itself. It is the PHP script, locator.php which assembles all the parsing components.