Forums de discussion

[SOLVED] Passing in variables into theme

thumbnail
Michael Poznecki, modifié il y a 15 années.

[SOLVED] Passing in variables into theme

Expert Publications: 301 Date d'inscription: 10/12/08 Publications récentes
Hello,
I have created a new theme. How can I dynamically pass in some values? Depending on what a user chooses in a dropdown listbox, I want to display some information in a <div> in the theme.

Does that make sense?

Thanks,
Michael
thumbnail
Mika Koivisto, modifié il y a 14 années.

RE: Passing in variables into theme

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
Theme can access the request and thus any query parameter given to the page.
thumbnail
Md Tannu .............., modifié il y a 14 années.

RE: Passing in variables into theme

Junior Member Publications: 52 Date d'inscription: 26/05/08 Publications récentes
Hi Mika Koivisto could u plz explain in more details...............
thumbnail
David Truong, modifié il y a 14 années.

RE: Passing in variables into theme

Expert Publications: 322 Date d'inscription: 24/03/05 Publications récentes
Mika is saying $request will give you access to the request... thus you can do $request.getParameter("parameter")

Note that the parameter will not be namespaced so you should make sure that you don't namespace it also in your form.

You can also insert values by sticking into the velocity context. Check out VelocityVariables
thumbnail
Michael Poznecki, modifié il y a 14 années.

RE: Passing in variables into theme

Expert Publications: 301 Date d'inscription: 10/12/08 Publications récentes
Thanks guys. The Velocity Variables worked. I found a couple of examples on the web.

http://issues.liferay.com/browse/LEP-1308

and

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Custom+Velocity+Variables
thumbnail
Michael Poznecki, modifié il y a 14 années.

RE: Passing in variables into theme

Expert Publications: 301 Date d'inscription: 10/12/08 Publications récentes
Ok,
so I would like to create a new array of information that can be access at any time while the user is logged in. I don't think that this can go into a velocity variable, so what can I use?

Thanks,
Michael
atul patel, modifié il y a 14 années.

Re: [Liferay Forums][3. Development] RE: Passing in variables into theme

Regular Member Publications: 192 Date d'inscription: 18/11/06 Publications récentes
Can you tell us more by what it needs to be accessed by? Portlets or
themes?

Atul Patel
+1-310-880-3574

On Jun 1, 2009, at 11:57 AM, "Michael Poznecki from liferay.com" <no-reply@liferay.com
> wrote:

> Ok,
> so I would like to create a new array of information that can be
> access at any time while the user is logged in. I don't think that
> this can go into a velocity variable, so what can I use?
>
> Thanks,
> Michael
> --
> Liferay Message Boards
> http://www.liferay.com/web/guest/community/forums/-/message_boards/message/3224470
> mb.239390.3224470@events.liferay.com
> http://www.liferay.com
thumbnail
Michael Poznecki, modifié il y a 14 années.

RE: Re: [Liferay Forums][3. Development] RE: Passing in variables into them

Expert Publications: 301 Date d'inscription: 10/12/08 Publications récentes
I need to be able to access my array at any time. Basically it is additional user information. I can take the array and get what I need out of it to put into a velocity variable, so in practice I really don't need to access the array from a theme.
thumbnail
David Truong, modifié il y a 14 années.

RE: Re: [Liferay Forums][3. Development] RE: Passing in variables into them

Expert Publications: 322 Date d'inscription: 24/03/05 Publications récentes
Just store it in the session and ignore putting it in the velocity context. I say that just in case you need to grab it from portlets.