Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Philipp Schrottmail
Footer as Web Content Display?
21 de enero de 2013 4:54
Respuesta

Philipp Schrottmail

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 14 de diciembre de 2012

Mensajes recientes

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?
21 de enero de 2013 2:19
Respuesta

Jignesh Vachhani

Ranking: Liferay Master

Mensajes: 783

Fecha de incorporación: 10 de marzo de 2008

Mensajes recientes

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?
21 de enero de 2013 2:53
Respuesta

Anil Sunkari

Ranking: Expert

Mensajes: 412

Fecha de incorporación: 11 de agosto de 2009

Mensajes recientes

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?
21 de enero de 2013 4:55
Respuesta

Philipp Schrottmail

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 14 de diciembre de 2012

Mensajes recientes

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?
21 de enero de 2013 23:04
Respuesta

Jignesh Vachhani

Ranking: Liferay Master

Mensajes: 783

Fecha de incorporación: 10 de marzo de 2008

Mensajes recientes

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?
22 de enero de 2013 1:41
Respuesta

Philipp Schrottmail

Ranking: New Member

Mensajes: 6

Fecha de incorporación: 14 de diciembre de 2012

Mensajes recientes

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?
22 de enero de 2013 2:03
Respuesta

Jignesh Vachhani

Ranking: Liferay Master

Mensajes: 783

Fecha de incorporación: 10 de marzo de 2008

Mensajes recientes

That's really cool Phillipp.emoticon