InterJinn

Development Framework For PHP

Tag: <jinn:component/>

Abstract

This tag is used in combination with the <jinn:module/> tag and its purpose is to describe the components that the <jinn:module/> tag will bind together into a module object. For detailed information about modules and components see the section about modules. This tag acknowledges the following attributes which are direct mappings to the attributes described in the section on modules.

Attribute - name

The name of the component as it may be retrieved by any of the other components in the module binding via $this->getObject(). This is an optional attribute; however, you must set it if you want to be able to use the component from any of the other components.

Attribute - source

This attribute is mandatory and accepts the path to the source file for the component. Remember that paths beginning with /// are retrieved relative to the coreRoot as defined in the project configuration, paths beginning with // are retrieved relative to the codeRoot as defined in the project configuration, paths beginning with / are relative to the root of the filesystem, and paths with neither prefix are treated as though they have a // prefix. See the section on modules for more information.

Attribute - class

The class need only be defined if it differs from the path structure. See the section about modules for details on this attribute since omission of this attribute requires that the component class follows a specific naming scheme.

Attribute - propertyPath

Setting this attribute will enable you to override the default property path which may be declared in the component class. This effectively lets the developer apply a completely different configuration scheme to the component.

It is very nice to have all of the configuration for a component described in an elegant tag system. Hopefully this will be one of the great features of the TemplateJinn system. The following example, while similar to that of the module example, illustrates how simply components can be configured and a module described.

Example:
<jinn:module name="displayNews">
    <jinn:component
            type="data"
            name="loader"
            source="//InterJinnWebsite/modules/mysqlGenericLoader.php"
            class="GenericMysqlLoader"/>
    <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>
    <jinn:component
            type="render"
            name="renderer"
            source="//InterJinnWebsite/modules/news/cascading.php"
            class="NewsCascading"
            properties="/news/skins/skyBlue"/>
</jinn:module>
The example above also serves to illustrate how individual property values can be set. For more information about setting component properties in this manner, please see the <jinn:property/> tag documentation.