掲示板

Footer as Web Content Display?

11年前 に Philipp Schrottmail によって更新されました。

Footer as Web Content Display?

New Member 投稿: 6 参加年月日: 12/12/14 最新の投稿
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
11年前 に Jignesh Vachhani によって更新されました。

RE: Footer as Web Content Display?

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
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
11年前 に Anil Sunkari によって更新されました。

RE: Footer as Web Content Display?

Expert 投稿: 427 参加年月日: 09/08/12 最新の投稿
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
11年前 に Philipp Schrottmail によって更新されました。

RE: Footer as Web Content Display?

New Member 投稿: 6 参加年月日: 12/12/14 最新の投稿
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
11年前 に Jignesh Vachhani によって更新されました。

RE: Footer as Web Content Display?

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
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.
11年前 に Philipp Schrottmail によって更新されました。

RE: Footer as Web Content Display?

New Member 投稿: 6 参加年月日: 12/12/14 最新の投稿
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
11年前 に Jignesh Vachhani によって更新されました。

RE: Footer as Web Content Display?

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
That's really cool Phillipp.emoticon