2 <:component:>

<:component name [named_args] [cache=no|yes|defer|force|old] [__args__]:>

This tag calls an STML component much as you would call a function in Python, and displays any resulting output of the component. It is not like including the STML component in your document. A component called with this tag does not get access to your document's local variables; you must pass any variables explicitly as named attributes in the <:component:> tag.

Since the component being called does not receive access to the calling document's local variables, it also does not have any access to the CONNECTION object, as included STML documents do. The only variables a called STML component has are the ones passed as attributes of the <:component:> tag, and any variables which the component creates for itself.

<:component foo.comp this=`56.7` that=`[5,6,7]`:>

executes the component foo.comp in the current directory, passing it the variables this and that. When foo.comp executes, it sees this and that as local variables, with the integer 56.7 and the list [5,6,7] assigned to them.

The __args__ argument is a way to be able to pass a dictionary of arguments to a component programatically. For example,

<:component foo.comp __args__=`{'this':56.7, 'that': [5,6,7]}`:>
is exactly equivalent to the previous example.

And as usual for STML tags, the __args__ could be any expression which results in either a dictionary or None.

Arguments specified via __args__ are overridden by values explicitly specified in the tag. For example,

<:component foo.comp a="3" __args__=`{'a':"5", 'b': 5}`:>
The foo.comp would get "3" as the value of the variable a.

One thing of note, specifying 'cache' as keys in the dictionary argument to __args__ does NOT affect either the deferral or caching semantics of the component, they get passed through as arguments to the component.

A way to call components from Python code is (see 9, page for details):

import AE.Component
print AE.Component.callComponent(name, argdict, 
	cache = whatever)
The whatever values are from the AE.Component module constants of the following:
NO
do not use the cache
YES
analogous to cache=yes in the <:component:> tag
DEFER
analogous to cache=defer in the <:component:> tag
FORCE
analogous to cache=force in the <:component:> tag
OLD
analogous to cache=old in the <:component:> tag


Subsections