HTML Markup

TurboPhp uses special markup inside the HTML layout file. Normally, the markup is handled by the page design in the IDE, but it is possible to create TurboPhp layout files manually.

Simple Template Markup

Simple named macros can be encoded into the HTML layout file, like so

The TTpApp object holds an array called Blocks. The TpApp will replace all instances of the above code with the block named 'macro_name'.

Blocks can be defined directly in the HTML like so:

<!--BEGIN macro_name -->
Block text or markup goes here.
<!--END macro_name -->

Object Markup

Dynamic elements are specified in HTML layout using special attributes. These elements are parsed by the TTpApp and converted into PHP objects at runtime. Properties of the object can be set, and functions can be attached that are called when events occur.

Here is an example of a TurboPhp object specification in HTML.

<div tpname="TpLabel1" tpclass="label" tpongenerate="TpLabel1Generate">TpLabel1</div>

This HTML code defines a standard <div> element, but the special attributes tpname and tpclass identify the element as a TurboPhp object. Every TurboPhp object must have tpname and tpclass attributes to be parsed correctly. Other optional TurboPhp attributes can be specified. The tpongenerate attribute in this case specifies that a function called TpLabel1Generate will be called when this object fires an OnGenerate event.