There is the complete list of built-in variables: (you can look in AbstractWebContext to see what is injected by default)

Context - the webengine context. you can use this to access any contextual data like the http request, response, traversed objects etc Module - the current webengine module (you can use this to find files in your module etc)
Engine  - the engine (a singleton object)
basePath - base path of the request
skinPath - the skin path (a prefix) to be used to create links to static resources Root - the root object (the first object in the chain matched by the request) This - the current (or target) object (e.g. the object which is rendered) Document - the current document if the current object is a document wrapper otherwise null Adapter - the current (target) adapter if the target object is an adapter otherwise null Session - the repository session if you have a repository otherwise null.

Note that you can also inject your own variables when rendering a template. See for example:
See for example the object Group.java in admin module:

    @GET
    public Object doGet() {
        return getView("index").arg("group", group);
    }


here ${group} is injected into the rendering context. You can do this when you want to expose custom variables but anyway the recommended way is to expose these objects through the ${This} variable.
Example: you create a method
public String getGroup() {
  return group;
}
on the target object and in the template you access the group like this: ${This.group} or ${This.getGroup()}

This is better since you don't hard-code variable names in java cod and also variables that need computations are lazy computed - only when the method is called from the template and not before the template is rendered.


Bogdan



On 27 août 09, at 09:42, Radu Ux D. wrote:

Hi

Do you refer to ActionFragments and Models (like contextualLinks model and its action fragment)? If so, you can check http://www.nuxeo.org/xwiki/bin/view/FAQ/DevelopWebEngineModule/. Also, look for theme-service (http://doc.nuxeo.org/5.1/books/nuxeo-book/html-single/#theme-service ) And of course, the Javadoc (I think webengine-sites can provide you with "how to do" example and also explains how the things works.)

If you need more info, please point what specifically do you think you miss.

Thx, Radu

Bruce Grant wrote:
I have spent the last week digging through samples, wiki/blog, and all existing documentation. It's been a challenge because the documentation is spread out in various areas and some seems out of date. Is there a definitive (internal?) document that spells out all of the variables and options available at rendering time? What are the limitations on their use? In one of the samples that documentation above explains the following variables are available:
Context - the WebContext instance
Engine - the WebEngine instance
This - the target Web Object.
Root - the root WebObject.
Document - the target Document if any otherwise null.
Session  - the Repository Session. (aka Core Session)
basePath - the request base path (context path + servlet path)
But it's apparent from the more recent Wiki/Blog app that other options are available from within the freemarker template (e.g., API). Are these options and capabilities enumerated and explained in any documentation?
Thank you,
Bruce.
------------------------------------------------------------------------
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Reply via email to