View Language API: Tags

How do they work?

A tag is a ViewLanguage representation of a scripting logic. All tags act like an extension of HTML standard and as such they have names and optionally attributes and bodies. There are two types of tags known by ViewLanguage:

A very powerful feature is the ability of tags to be recursive: it is allowed to put View Language tags inside View Language tags. Whenever that happens, compiler goes progressively deeper until no tags are left.

Macro Tags

These are tags that work in a way similar to C macros: before code is compiled, they are read and "expanded" so that compilation will run on a full source.

What is their syntax?

Syntax is identical to that of normal HTML tags:

<name attribute="value" .../>


What does API already include?

API defines following macro tags:

How can developers create their own macro tags?

At the moment, it is not possible for users to define their own macro tags!

Library Tags

Library tags are compilable api/user-defined HTML snippets expected to implement scripting logic in a View Language application. They are non-static repeating snippets of template (html) code that depend on variables and thus can't be loaded using <include>.

What is their syntax?

Their syntax also extends HTML standard:

<library:name attribute="value" ...>...</library:tag>

or, if they have no body:

<library:name attribute="value" .../>


What does API already include?

API includes a standard library containing tags for programming language instructions where library name is always empty:

How can developers create their own tag libraries?

In order to break up HTML response into discrete units, developers must create their own libraries & tags.

User defined tags are found on disk according to these rules:

  1. library name must correspond to a folder found inside tag library folder supplied on compilation.
  2. tag body is automatically matched to a procedural PHP file found inside folder above, whose name equals that of tag.
    Example: tag <test:foo .../> => file test/foo.php