Foros de discusión

Footer as Web Content Display?

Philipp Schrottmail, modificado hace 11 años.

Footer as Web Content Display?

New Member Mensajes: 6 Fecha de incorporación: 14/12/12 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

			
			$velocityPortletPreferences.setValue("portlet-setup-show-borders","false")
			$velocityPortletPreferences.setValue("group-id", "$group_id")				
			$theme.runtime("56_INSTANCE_1851somespecialId", "", $velocityPortletPreferences.toString())
			#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?
thumbnail
Jignesh Vachhani, modificado hace 11 años.

RE: Footer as Web Content Display?

Liferay Master Mensajes: 803 Fecha de incorporación: 10/03/08 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.
thumbnail
Anil Sunkari, modificado hace 11 años.

RE: Footer as Web Content Display?

Expert Mensajes: 427 Fecha de incorporación: 12/08/09 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, modificado hace 11 años.

RE: Footer as Web Content Display?

New Member Mensajes: 6 Fecha de incorporación: 14/12/12 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)
thumbnail
Jignesh Vachhani, modificado hace 11 años.

RE: Footer as Web Content Display?

Liferay Master Mensajes: 803 Fecha de incorporación: 10/03/08 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, modificado hace 11 años.

RE: Footer as Web Content Display?

New Member Mensajes: 6 Fecha de incorporación: 14/12/12 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.


			#set ($articleName = "myFooter")

			#set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))
			#set ($articleId = $journalArticleLocalService.getArticleByUrlTitle($themeDisplay.getScopeGroupId(), $articleName).getArticleId())			
			#set ($articleContent = $journalContentUtil.getContent($themeDisplay.getScopeGroupId(), $articleId, null, $locale.toString(), $themeDisplay))
			
			$articleContent


thx again for your help
thumbnail
Jignesh Vachhani, modificado hace 11 años.

RE: Footer as Web Content Display?

Liferay Master Mensajes: 803 Fecha de incorporación: 10/03/08 Mensajes recientes
That's really cool Phillipp.emoticon