InterJinn

Development Framework For PHP

Embed: {jinn:getValue}

Abstract

Alias: {jinn:value}

This embed creates provides an interface to variables of various types. most notable are variables stores in InterJinn modules, and the keys and values produced via the <jinn:foreach/> tag. Moreover, this embed is often responsible for providing the value over which a <jinn:foreach/> tag can iterate, or upon which an <jinn:if/>, or <jinn:elseif/> tag may conditionally branch.

Attribute - type

Set this attribute to the type of value to retrieve. The are currently three types supported: module, foreach, and local. Since each of these requires a different set of parameters -- the rest of the attributes are listed with respect to the type with which they identify. If no type is specified then the default is local.

The "module" Type

This type is used to access instance variables of a given module's component.

Attribute - name

This is the name of the module to reference. The name should have been set (or will be set) by the inclusion of a <jinn:module/> tag.

Attribute - component

This is the name of the module's component from which we wish to retrieve an instance variable. The name should have been set (or will be set) by the inclusion of a <jinn:component/> tag.

Attribute - member

This is the name of the actual instance variable to retrieve.

Attribute - path

Given that the instance variable is an associative array, you may define a path to use to lookup the desired entry in the array. The path is used to traverse sub arrays and each subarray is denoted by a forward slash (/). Note that if your keys contain forward slashes then using the path to retrieve the key will fail.

Example:
{jinn:getValue
    type=module,
    name=client,
    component=display,
    member=hasPurchaseOrders}

The "foreach" Type

This type is used to access the key or value for a given iteration of a <jinn:foreach/> loop.

Attribute - name

This is the name of the foreach loop to reference. The name should have been set by the inclusion of a <jinn:foreach/> tag.

Attribute - part

This denotes the part of the current iteration to retrieve. The value may be one of key or value. If this attribute is not set or is unrecognized then a default of value is used.

Attribute - path

Given that the retrieved value is an associative array, you may define a path to use to lookup the desired entry in the array. The path is used to traverse sub arrays and each subarray is denoted by a forward slash (/). Note that if your keys contain forward slashes then using the path to retrieve the key will fail.

Example:
{jinn:getValue
    type=foreach,
    name=stocks,
    part=value}

The "local" Type

This type is used to access a variable within the current scope (expected to be the global scope). Generally there won't be much need for variables in this scope, but the developer might find it useful to access data in one of the many super global arrays. This type is the default when no type has been specifid or recognized.

Attribute - name

This is the name of the variable within the current scope.

Attribute - separator

Sets the separator to use when traversing a multi-dimensional array using the path attribute. The default is the forward slash (/) but there are times you may need to have this treated literally.

Attribute - path

Given that the retrieved value is an associative array, you may define a path to use to lookup the desired entry in the array. The path is used to traverse sub arrays and each subarray is denoted by a forward slash (/). Note that if your keys contain forward slashes then using the path to retrieve the key will fail.

Example:
{jinn:getValue name=_POST, path=ccNumber}