You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Angel Garcia <ag...@gmail.com> on 2006/05/29 23:22:39 UTC

using variable content in velocity only layout

Hi,

I have a question about put some dynamic code in the velocity only layout.

I create a java class and I wanna use in the Default.vm layout (that
is, use the class in the velocity context of the layout).

I try with

public class Default extends VelocityOnlyLayout
{
    public void doBuild (RunData data) throws Exception
    {
	Context context = TurbineVelocity.getContext(data);
	
	Myclass mid = new Myclass (6, 7);

	context.put ("mid", midi);

	super.doBuild (data);
    }
}
in src/java/org/apache/turbine/app/turbine_menus/modules/layouts

and use the variable $mid in Defalult.vm, but this don't work


Is there any solution?

tanks for your help

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: using variable content in velocity only layout

Posted by David Demner <tu...@demner.com>.
Hi,

I think you need to extend VelocityScreen, as specified on
http://jakarta.apache.org/turbine/turbine/turbine-2.3.2/howto/velocity-site-
howto.html

---------
public class HelloWorld extends VelocityScreen
{
    public void doBuildTemplate( RunData data, Context context )
        throws Exception
    {
        // the context object has already been setup for you!
        context.put ("hello", "this is a test...");
    }
}
---------

This would be in src/java/org/apache/turbine/app/turbine_menus/screens

Good luck,

David

-----Original Message-----
From: Angel Garcia [mailto:agarciazav@gmail.com] 
Sent: May 29, 2006 2:23 PM
To: turbine-user@jakarta.apache.org
Subject: using variable content in velocity only layout

Hi,

I have a question about put some dynamic code in the velocity only layout.

I create a java class and I wanna use in the Default.vm layout (that
is, use the class in the velocity context of the layout).

I try with

public class Default extends VelocityOnlyLayout
{
    public void doBuild (RunData data) throws Exception
    {
	Context context = TurbineVelocity.getContext(data);
	
	Myclass mid = new Myclass (6, 7);

	context.put ("mid", midi);

	super.doBuild (data);
    }
}
in src/java/org/apache/turbine/app/turbine_menus/modules/layouts

and use the variable $mid in Defalult.vm, but this don't work


Is there any solution?

tanks for your help

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org