留言板

How can I access variable defained in template into web content?

thumbnail
Vikas Kadam,修改在12 年前。

How can I access variable defained in template into web content?

New Member 帖子: 22 加入日期: 11-6-15 最近的帖子
Hi,
I'm not sure whether it is possible to access dynamic content into static content. Is it possible to access variable defained in template into web content?

-Vicky
thumbnail
Anil Sunkari,修改在12 年前。

RE: How can I access variable defained in template into web content?

Expert 帖子: 427 加入日期: 09-8-12 最近的帖子
I understood that you want to access variable.But that variable you defined in structure or anything else you need over there.Can you be more clear?
thumbnail
Vikas Kadam,修改在12 年前。

RE: How can I access variable defained in template into web content?

New Member 帖子: 22 加入日期: 11-6-15 最近的帖子
Thanks Anil

I don't need the variables in structure.
I want to declare a local variable in my template VM code to assign a value upon a condition. Now I need to access this value in web content using the variable defined in the template code.
e.g.
#set( $url= "www.xyz.com" )
now I want this url variable to be accessed in web content.

-Vicky
Oliver Bayer,修改在12 年前。

RE: How can I access variable defained in template into web content?

Liferay Master 帖子: 894 加入日期: 09-2-18 最近的帖子
Hi Vikas,

one possible solution would be to extend the JournalVMUtil class. Take a look at my response at the following thread.

HTH Oli
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: How can I access variable defained in template into web content?

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Do you want to access the variable in client side javascript? The content of the variable can be written out to a html page.
Can you eloborate on how you want to access the value in the web content.