0 of 1 found this page helpful

Determining the implicit environment passed to extensions

    Table of contents
    No headers

    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() }}
    
    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by