You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by phillip rhodes <rh...@telerama.com> on 2002/09/08 22:57:37 UTC

add object to the context for all templates?

Hello.
I want to have an object that will be available in all of my velocity templates.  I know I can add this object in each of my individual screen files via doBuildTemplate()
Or subclass my screen and call super.doBuildTemplate()

Is there another way?

Thanks,
Phillip

Re: add object to the context for all templates?

Posted by Jeff Linwood <je...@greenninja.com>.
Hi,

Check out the Pull Model HOWTO, the "Push vs Pull" discussion, and the Pull
Service documentation for the TDK.

The basic strategy is to make your object into a Tool (check the Java doc
for ApplicationTool) and then define it in TurbineResources.properties as a
tool of global, session, or request scope.

Then you can access it in any Velocity template as $myTool or whatever.

Thanks,
Jeff
----- Original Message -----
From: "phillip rhodes" <rh...@telerama.com>
To: "turbine-user" <tu...@jakarta.apache.org>
Sent: Sunday, September 08, 2002 3:57 PM
Subject: add object to the context for all templates?


Hello.
I want to have an object that will be available in all of my velocity
templates.  I know I can add this object in each of my individual screen
files via doBuildTemplate()
Or subclass my screen and call super.doBuildTemplate()

Is there another way?

Thanks,
Phillip



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>