Combination View Flat View Tree View
Threads [ Previous | Next ]
Philipp Schrottmail
Footer as Web Content Display?
January 21, 2013 4:54 AM
Answer

Philipp Schrottmail

Rank: New Member

Posts: 6

Join Date: December 14, 2012

Recent Posts

Hi there,

I have already found several Threads on embedding WebContentDisplay into a theme but none of them solve my problem.

Here's the basic setup. I have embedded WebContentDisplay Portlets into my theme with the following commands

1            
2            $velocityPortletPreferences.setValue("portlet-setup-show-borders","false")
3            $velocityPortletPreferences.setValue("group-id", "$group_id")               
4            $theme.runtime("56_INSTANCE_1851somespecialId", "", $velocityPortletPreferences.toString())
5            #set ($VOID = $velocityPortletPreferences.reset())               


to get a layout like this



so people can edit it to something like this.



The footer should be the same on every page. simple stuff.

Of course, what I could do now is to create some articles set their article IDs in velocityPortletPreferences in my theme and I'd be all set.
The only problem now is that with the way we use liferay there will be dynamically created community sites in the future and I will not know the articleIds.

Now if I don't specify an articleId in the theme, the WebContentDisplays will be separate instances on every page and not automatically share their content. One would have to set the content on every page manually and again whenever a new page gets created.

On the other hand, If I do specify an articleId, there will be the message "The selected web content no longer exists." and I cannot edit, only create new content but then the problem is the same as above.

I hope I could convey my problem clearly. What could I do?
Jignesh Vachhani
RE: Footer as Web Content Display?
January 21, 2013 2:19 AM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 780

Join Date: March 10, 2008

Recent Posts

Phillip

Did you take a look on http://www.liferaysolution.com/2011/12/embed-or-integrate-web-content-in-theme.html ?
Here its working for me properly.
I think this is the only solutions you might be looking for.
Anil Sunkari
RE: Footer as Web Content Display?
January 21, 2013 2:53 AM
Answer

Anil Sunkari

Rank: Expert

Posts: 385

Join Date: August 11, 2009

Recent Posts

Hi Philipp,

Please check the last comment in the discussion happened in the below URL.

http://www.liferay.com/community/forums/-/message_boards/message/772138

Regards,
Anil Sunkari
Philipp Schrottmail
RE: Footer as Web Content Display?
January 21, 2013 4:55 AM
Answer

Philipp Schrottmail

Rank: New Member

Posts: 6

Join Date: December 14, 2012

Recent Posts

Wow. My initial post was published when my session ran out without me pressing any button? I came back after lunchbreak an it was already posted but I wasn't finished writing. :/

Plz re-read my initial post. The solutions you have linked so far seem to work because they know the articleIds in advance which I don't (expcept there was a way to auto create journal-content with a certain Id when a new community is created)
Jignesh Vachhani
RE: Footer as Web Content Display?
January 21, 2013 11:04 PM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 780

Join Date: March 10, 2008

Recent Posts

Phillip
No it's not the article id actually, it's a article title URL which will be generated once article will be created.
Let say if you create article called "My Article" then liferay will generate article title URL with "my-article"
and if you see the code from http://www.liferaysolution.com/2011/12/embed-or-integrate-web-content-in-theme.html , we used
$journalArticleLocalService.getArticleByUrlTitle
So we are not getting article object from article id but we are getting it using article title.

Hope this would be clear to you now.
Philipp Schrottmail
RE: Footer as Web Content Display?
January 22, 2013 1:41 AM
Answer

Philipp Schrottmail

Rank: New Member

Posts: 6

Join Date: December 14, 2012

Recent Posts

Jignesh

Thank you very much. I'm sorry I only skimmed the code on my first read through but your solution works for me and my problem is now solved.

The code on the page didn't work out-of-the box though.

here is what I used.

1
2            #set ($articleName = "myFooter")
3
4            #set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
5            #set ($articleId = $journalArticleLocalService.getArticleByUrlTitle($themeDisplay.getScopeGroupId(), $articleName).getArticleId())            
6            #set ($articleContent = $journalContentUtil.getContent($themeDisplay.getScopeGroupId(), $articleId, null, $locale.toString(), $themeDisplay))
7            
8            $articleContent


thx again for your help
Jignesh Vachhani
RE: Footer as Web Content Display?
January 22, 2013 2:03 AM
Answer

Jignesh Vachhani

Rank: Liferay Master

Posts: 780

Join Date: March 10, 2008

Recent Posts

That's really cool Phillipp.emoticon