InterJinn

Development Framework For PHP

Tag: <jinn:property/>

Abstract

The property tag might just be every web developer's dream-come-true. There are two contexts for this tag. The first is when placed between a <jinn:component/> tag in which case the property tag is used to defined properties for the component at the declaration level (these properties can override properties normally defined by the components propertyPath). The context is when the tag is used anywhere else, in which case it means to replace the tag with the associated property's value. For information about how to define a property and how they function you should refer to the properties documentation. There are several attributes you may use to fully describe the property you want and it's behaviour. It is important to note that if the site is multilingual then all features of multilingual property resolution will still be valid.

Attribute - dynamic (non component only)

A value of true or false must be given to this attribute. If not specified then the default is false. When set to true the property value will not actually be inserted at compile time, instead a call to load the property will be inserted which will run each time the page is accessed. The difference may seem small, but if the value is true then updating the property value in the database will be seen on the web page as soon as the property cache is flushed -- although this depends on the property type. A property of type query could easily keep the value retrieved from a feed up to date in the content. The downside is that the load time of the page will take a small performance hit.

Attribute - canonical (non component only)

The value of this attribute will canonically describe a property to retrieve. The format is [group]:path:name. This is a convenient shorthand for including property values in your content.

Attribute - group

The group to which the property belongs as described in the properties section. This attribute is ignored if the canonical property is set. This attribute is optional.

Attribute - path (non component only)

The path to which the property should be resolved as described in the section about properties. This attribute is ignored if the canonical property is set.

Attribute - name

The name of the property as set in the properties table. This attribute is ignored if the canonical property is set.

Attribute - value (component only)

The value of this attribute will be assigned to the component's property. If a property with the given group and name already exist, then it will be overriden. A value may also be set for the property by enclosing it between the opening and closing tags. This is convenient for large amounts of text or otherwise.

The following example illustrates a property declaration in the component context.

Example:
<jinn:component
        type="logic"
        name="manager"
        source="//InterJinnWebsite/modules/news/manager.php"
        class="NewsManager">
    <jinn:property
            group="urls"
            name="sourceUrl"
            value="http://www.somegreatnews.cmx/feed.xml"/>
</jinn:component>

The following example illustrates the difference between using the tag with the canonical attribute and without in a non component context. It is plain to see that the canonical incarnation is less wordy; however, it is also less readable.

Example:
<jinn:property
    group="help"
    path="sitemap/navigator"
    name="linkHelp"
    dynamic="true"/>
Canonical Example:
<jinn:property
    canonical="help:sitemap/navigator:linkHelp"
    dynamic="true"/>