留言板

[SOLVED] Passing in variables into theme

thumbnail
Michael Poznecki,修改在15 年前。

[SOLVED] Passing in variables into theme

Expert 帖子: 301 加入日期: 08-12-10 最近的帖子
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,修改在14 年前。

RE: Passing in variables into theme

Liferay Legend 帖子: 1519 加入日期: 06-8-7 最近的帖子
Theme can access the request and thus any query parameter given to the page.
thumbnail
Md Tannu ..............,修改在14 年前。

RE: Passing in variables into theme

Junior Member 帖子: 52 加入日期: 08-5-26 最近的帖子
Hi Mika Koivisto could u plz explain in more details...............
thumbnail
David Truong,修改在14 年前。

RE: Passing in variables into theme

Expert 帖子: 322 加入日期: 05-3-24 最近的帖子
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,修改在14 年前。

RE: Passing in variables into theme

Expert 帖子: 301 加入日期: 08-12-10 最近的帖子
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,修改在14 年前。

RE: Passing in variables into theme

Expert 帖子: 301 加入日期: 08-12-10 最近的帖子
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,修改在14 年前。

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

Regular Member 帖子: 192 加入日期: 06-11-18 最近的帖子
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,修改在14 年前。

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

Expert 帖子: 301 加入日期: 08-12-10 最近的帖子
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,修改在14 年前。

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

Expert 帖子: 322 加入日期: 05-3-24 最近的帖子
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.