InterJinn

Development Framework For PHP

Jinn Compiler Embeds

Embeds are similar to a tags. They allow for the insertion of content at a specific point in the compilation of the template and source content. The reason for this kind of redundancy is to provide a way to include data in the attribute values of existing tags. Generally speaking this would not be a problem for regular HTML tags since we are using LXML (Layered XML). The problem is more along the lines of perhaps using the <jinn:link/> tag but also wanting to use a database property to fulfill the value of the attribute. This is where embeds come in handy since they can be embedded in the value of an attribute or if you like - directly in the content. Embeds are a lot like tags but have a different format for including attributes.

You will notice that most of the embed names consist of the jinn: prefix. This refers to an embed's space. If you create your own compiler and support embeds, then you will define your own space. This makes it possible to clearly define embeds of the same name but which should not be processed by the same compiler. You will also notice that there are three embeds that do not exhibit the space feature. Those embeds are core embeds and are processed by the templating system itself before the content is passed to any compilers.

There are several parts to an embed. These are the space, name, and an arbitrary number of attributes. The format is depicted in the following example:

Example:
{jinn:foo param1=param1Value, param2=param2Value}

An extremely powerful aspect of the embed system is that they can be nested. An embed can have as one of it's parameter values another embed. This is illustrated below:

Example:
{jinn:echo
    value={jinn:property
        group=data,
        path=/weather/feed,
        name=tCelsius}}