InterJinn

Development Framework For PHP

Tag: <jinn:if/>, <jinn:elseif/>, <jinn:else/>

Abstract

The JinnTemplateTM system allows for logic control in the templates via the <jinn:if/>, <jinn:elseif/>, and <jinn:else/> tags. The result is that complex content can still be maintained in the template even though logical conditions may need to be met for its inclusion. These tags work on a name system, meaning that content can flow between the end of an <jinn:if/> tag and the beginning of an <jinn:elseif/> or <jinn:else/> tag. This may or may not be useful to the developer. The following attributes are recognized by these tags.

Attribute - name

Set this attribute to the name of the conditional block. This makes it simple to nest conditional blocks. Note that nesting a conditional block of the same name will create odd behaviour since the state of the conditional will be reset. This attribute is recognized by the <jinn:if/>, <jinn:elseif/>, and <jinn:else/> tags.

Attribute - test

Set this attribute to the value to test for the conditional block. If the value evaluates to true then the content within the conditional will be output. Note that the test of the value is performed at run-time, and NOT during compilation. This attribute is expected to be used most often in conjunction with the {jinn:getValue} embed. This attribute is recognized by the <jinn:if/> and <jinn:elseif/> tags.

The following example outlines the syntax used for the conditional tags:

Example:
<jinn:if name="test" test="{jinn:getValue name=showAddress}">
    Address: 123 Somewhere Drive
</jinn:if>
<jinn:else name="test">
    - - - -
</jinn:else>