Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Joe Terhune
Extend Web Content Display
September 27, 2013 7:43 AM
Answer

Joe Terhune

Rank: New Member

Posts: 3

Join Date: September 27, 2013

Recent Posts

I have a request from a client to add the last modified date to the end of the Web content display. What is the easiest way to accomplish this?
Joe Terhune
RE: Extend Web Content Display
October 2, 2013 12:01 PM
Answer

Joe Terhune

Rank: New Member

Posts: 3

Join Date: September 27, 2013

Recent Posts

The best solution I could find was to create a structure with one text/html field called "Content" and create the template as follows.

$Content.getData()
<p class="lastmodified">last modified: $dateTool.format("MM/dd/yyyy hh:mm",
$dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z",
$reserved-article-modified-date.getData()), $locale)</p>
Erick Sanematsu
RE: Extend Web Content Display
November 14, 2013 3:13 AM
Answer

Erick Sanematsu

Rank: New Member

Posts: 7

Join Date: August 2, 2013

Recent Posts

Hello Joe,

I have the same issue as you do.
But for me, this solution didn't work. Actually i have my structure and my template, and inside of the velocity script i'm inputting your code but nothing happens.
I don't create your "Content" on my structure, I just put your code inside of <p>.
This variable $dateTool and $locale must be initialized somewhere?

Thanks!
Joe Terhune
RE: Extend Web Content Display
November 14, 2013 5:02 AM
Answer

Joe Terhune

Rank: New Member

Posts: 3

Join Date: September 27, 2013

Recent Posts

$dateTool is a velocity method
$locale is a velocity variable

It may be the version of Liferay your using doesn't support these. I am using version 6.1
Erick Sanematsu
RE: Extend Web Content Display
November 14, 2013 10:56 AM
Answer

Erick Sanematsu

Rank: New Member

Posts: 7

Join Date: August 2, 2013

Recent Posts

Hello Joe,

I contacted the liferay's people, and they suggested to put the following code:

$dateTool.format("dd/MM/yyyy", $dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", $reserved-article-modified-date.getData(), $locale))

And this works fine for me, and the only diference between our codes is the position of $locale variable.

Thanks!