Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gaurang Sheladia
How to read Velocity Template file in Liferay ?
July 1, 2010 6:14 AM
Answer

Gaurang Sheladia

Rank: Regular Member

Posts: 160

Join Date: February 15, 2009

Recent Posts

Hi All,

Does anyone knows that how to read velocity template file from liferay plugin portlet?

Acutally i want to read one .vm file from my portlet.


Any suggestion would really appreciated.


Thanks in advance.

Thanks,
Gaurang
Gaurang Sheladia
RE: How to read Velocity Template file in Liferay ?[SOLVED]
July 1, 2010 9:40 AM
Answer

Gaurang Sheladia

Rank: Regular Member

Posts: 160

Join Date: February 15, 2009

Recent Posts

Hi All,

Finally i have done it with Liferay API.

Regards,
Gaurang
Szymon Gołębiewski
RE: How to read Velocity Template file in Liferay ?[SOLVED]
July 1, 2010 2:35 PM
Answer

Szymon Gołębiewski

Rank: Regular Member

Posts: 247

Join Date: June 8, 2009

Recent Posts

Can you post how?
Gaurang Sheladia
RE: How to read Velocity Template file in Liferay ?[SOLVED]
July 23, 2010 12:14 AM
Answer

Gaurang Sheladia

Rank: Regular Member

Posts: 160

Join Date: February 15, 2009

Recent Posts

Hi Simon,

Yes i am definitely posting the solution.

I have done this with Liferay API as

InputStream is = MycustomPortlet.class.getClassLoader().getResourceAsStream("resource/MyInfo.vm");


Let me know if you need any more info.

Hope it will help.

Best,
Gaurang Sheladia
Gaurang G
RE: How to read Velocity Template file in Liferay ?
September 13, 2010 4:37 AM
Answer

Gaurang G

Rank: New Member

Posts: 16

Join Date: April 28, 2010

Recent Posts

Hi Gaurang,

A newbie question,
It is possible to check what all functions are available on custom velocity variables (variable that I define in the structure).?

eg. I created a structure with a Link (named "link") of type "Link to Page" and used
link.getUrl() to get the URL of the linked page. So I was wondering how to check of the other variables that are available with other types (eg. other then getUrl() as in this case).
Gaurang Sheladia
RE: How to read Velocity Template file in Liferay ?
September 13, 2010 8:04 AM
Answer

Gaurang Sheladia

Rank: Regular Member

Posts: 160

Join Date: February 15, 2009

Recent Posts

Hi Gaurang,

Are you talking about the Journal Structure Velocity variable that we are using for Article ?

Please clarify. I Will respond you ASAP.

Thanks,
Gaurang
Gaurang G
RE: How to read Velocity Template file in Liferay ?
September 16, 2010 10:54 PM
Answer

Gaurang G

Rank: New Member

Posts: 16

Join Date: April 28, 2010

Recent Posts

Gaurang Sheladia:
Hi Gaurang,

Are you talking about the Journal Structure Velocity variable that we are using for Article ?

Please clarify. I Will respond you ASAP.

Thanks,
Gaurang


Hi Gaurang,

Indeed, I was referring to the same. I was looking for what all functions are available on the variables we can create. getUrl() is one such function on type "Link to Page".
vijay pandey
how we include jsp/html file in template file(.tpl)
October 14, 2010 12:16 AM
Answer

vijay pandey

Rank: Junior Member

Posts: 44

Join Date: September 1, 2010

Recent Posts


hi
Can we include any jsp/html file in .tpl file when we going to making template development ..
If yes the how we can include ..

Please help
Thanks in advance
ankit yakkundi
RE: How to read Velocity Template file in Liferay ?
December 27, 2010 9:14 PM
Answer

ankit yakkundi

Rank: Regular Member

Posts: 221

Join Date: March 4, 2010

Recent Posts

Hi Gaurang..
I have some issues with Templates in Liferay ,hoping that you can solve my doubts.

1) How to create JSP templates? There are no samples and documentation available for JSP-based templates in forums/technical documentation.

2) How to incorporate css/htmls received from a web designer into a velocity template; Assuming completely different look and feel. Do you have any examples?

These are the two issues i am facing, can i get ant sample code or documentation for the same and for learning velocity Template??


Thanks in advance..
Any idea or suggestions are welcome..emoticon
Gaurav Jain
RE: How to read Velocity Template file in Liferay ?
February 9, 2011 10:07 PM
Answer

Gaurav Jain

Rank: Regular Member

Posts: 146

Join Date: January 31, 2011

Recent Posts

ankit yakkundi:


1) How to create JSP templates? There are no samples and documentation available for JSP-based templates in forums/technical documentation.


Even I am curious to know emoticon

ankit yakkundi:

2) How to incorporate css/htmls received from a web designer into a velocity template; Assuming completely different look and feel. Do you have any examples?



You can create vm templates just like html page (incorporating vm power).

For example:
<style>
your css goes here...
</style>

<div class="any_class">
#if ($link.getData() != "")
<a href="$link.getData()">
#end
<img alt="" src="$image.getData()" />
#if ($link.getData() != "")
</a>
#end
</div>


Or you can you can just use html tags with proper class and id attributes in vm files and add your css in theme.
vijay pandey
RE: How to read Velocity Template file in Liferay ?
May 12, 2013 11:42 PM
Answer

vijay pandey

Rank: Junior Member

Posts: 44

Join Date: September 1, 2010

Recent Posts

Thnaks but instead of using JSP template ,you can use .vm templates in liferay that is easily modifiable .