When an extension function is invoked, MindTouch passes along an implicit environment. The values in the implicit environment contain information about the page, user, and site on which the function is being invoked on. This makes it possible to customize the output without requiring the function to explicitly receive these values.
The code below is taken from the test.xml script and shows the implicit values for page, user, and site.
Function Code
<function>
<name>implicit</name>
<description>Test implicit arguments.</description>
<return>
<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
<body>
Site: <eval:expr>site</eval:expr><br />
Page: <eval:expr>page</eval:expr><br />
User: <eval:expr>user</eval:expr><br />
</body>
</html>
</return>
</function>
Invocation (for the above code snippet only)
{{ test.implicit() }}
Invocation for the original test.xml script:
{{ test.return_implicit_env() }}
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by