Fórum

Passing variable or parameters from a portlet to the portal_normal.vm

thumbnail
domingo l hilario, modificado 14 Anos atrás.

Passing variable or parameters from a portlet to the portal_normal.vm

Junior Member Postagens: 46 Data de Entrada: 05/02/09 Postagens Recentes
Good Morning Guys,

I have a little issue. I've been trying to set a variable that if it show no content then the portal_normal.vm will close the breaking news banner.

what I am trying to do is

set paramenter or string on cn2-breaking news portlet. The value content.length > 0 the variable or parameter will be set and pass to the portal_normal.vm



#set( $active = request.get("parameter").get("active") )

#if (!$active)
<div class="breaking news"> flash scrolling text </div>
#end

<b>$active</b>



I need some help. Is that durable? can that be done.
thumbnail
Lisa Simpson, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Liferay Legend Postagens: 2034 Data de Entrada: 05/03/09 Postagens Recentes
*BUMP*
thumbnail
domingo l hilario, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Junior Member Postagens: 46 Data de Entrada: 05/02/09 Postagens Recentes
*BUMP*, come on Lisa you can do better than that. ;)

Can this be done.
thumbnail
Lisa Simpson, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Liferay Legend Postagens: 2034 Data de Entrada: 05/03/09 Postagens Recentes
If I knew, I would tell you. Quite frankly, I have no idea. Hence the *BUMP*
thumbnail
domingo l hilario, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Junior Member Postagens: 46 Data de Entrada: 05/02/09 Postagens Recentes
I know, I was just kidding with you...
thumbnail
Bruno Farache, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Domingo Hilarious, "parameter" should be in the plural, like:

$request.parameters.active
or
$request.get("parameters").get("active")

*BUMP*
thumbnail
domingo l hilario, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Junior Member Postagens: 46 Data de Entrada: 05/02/09 Postagens Recentes
sorry I miss spelled it

will this work, and how do I called it from the portlet


import java.io.StringWriter;
import java.io.Writer;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.tools.generic.RenderTool;

public class VMDemo {

public static void main(String[] args) throws Exception {
Velocity.init();
Template t = Velocity.getTemplate("./src/VMDemo.vm");

VelocityContext ctx = new VelocityContext();

ctx.put("myName","Joe");
Writer writer = new StringWriter();
t.merge(ctx, writer);

System.out.println(writer);
}
}
thumbnail
Bruno Farache, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Sorry I didn't get it, you typed render.parameters incorrectly in your script and now is working or you typed it incorrectly in this forum thread?

Use com.liferay.portal.kernel.velocity.VelocityEngineUtil to process vm scripts from portlets.
thumbnail
domingo l hilario, modificado 14 Anos atrás.

RE: Passing variable or parameters from a portlet to the template .vm

Junior Member Postagens: 46 Data de Entrada: 05/02/09 Postagens Recentes
I am trying whatever I can do to pass either a variable, paramter, or proterty to the portal_normal.vm

I have look at the package you metioned, and I thouth the package is located under the portal-kernel.jar file but is not there. where can I find the jar file with the velocity.