<:include name:>
The STML tag <:include:> executes an STML component document named name in the namespace of the currently executing component.
The format of the string for name is a path, such as /foo/bar.inc or foo.inc. If the path is absolute, starting with a slash, the templating engine will look for the component at that path underneath your documentRoot of STML documents. If the path is relative, not starting with a slash, the templating engine looks for the component inside the current document's directory. You can also use `..' to move up a directory, just as you do on a Unix or DOS command line (but you cannot escape the documentRoot).
For example, you have these three files in your documentRoot directory:
/header.inc /myDir/index.html /myDir/foo.inc
Inside /myDir/index.html, you want to include both component files. You can use these tags, the first using an absolute path and the second using a relative path:
<:include /header.inc:> <:include foo.inc:>
Unlike the <:component:> (see section 4.2, page
<:set myVar `5`:> <:include foo.inc:> <:val `myVar`:><BR> <:val `myOtherVar`:>
and the STML component document foo.inc contains this STML code:
<:set myVar `66`:> <:set myOtherVar "hey man":> Hey I'm done!
then the output of /index.html is:
Hey I'm done! 66 hey man
A way to do includes from Python code is as follows:
import AE.Component print AE.Component.callComponent(name, argdict, compType=AE.Component.DT_INCLUDE)
Re file extensions: The .inc and .pyinc file extensions were added in SkunkWeb 3.2; previous versions used the .comp and .pycomp file extensions for includes, and these will still work. However, since it is rather important to distinguish the two types of components, using the new include extensions is recommended.
NOTE: The main thing to keep in mind here is that if you do the include from a Python component, things work as you would expect, but if you call it from Python code that isn't a component (or an include), the included component runs in the namespace of the currently running component, not the namespace of the Python module you call it from.