« Back

How to embed a Web Content on your theme?

Technical Blogs August 22, 2014 By Paulo Fernandes Staff

Hi guys

Most of the time I need to embed a Web Content on the theme that I develop.

To solve this I usually insert a Web Content Portlet using the following code:

#set ($VOID = $velocityPortletPreferences.setValue('groupId', $themeDisplay.getCompanyGroupId().toString()))
#set ($VOID = $velocityPortletPreferences.setValue('articleId', $webContentID))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_ABC1")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
Some days ago, I was talking with others guys and Travis said to me that I can do this in another way.
The following code insert the content of the "web content" where I need.
 
$journalContentUtil.getContent( $themeDisplay.getCompanyGroupId(), $webContentID, null, $locale.toString(), $themeDisplay ) 
 
If you know another way to embed a Web Content or a portlet let us know in comments.
 
See you soon :)
 
No comments yet. Be the first.