Fórum

Rendering Web Content in Theme

bob brinks, modificado 10 Anos atrás.

Rendering Web Content in Theme

New Member Postagens: 10 Data de Entrada: 20/06/13 Postagens Recentes
Hi all,

I'm trying to render web content in the 'header' (a velocity template) of my theme. It's multiple articles of a single structure. This structure has a field of the type "Link to page".

I'm using the following code to render the content.
    #set ($banners = $journalArticleLocalService.getStructureArticles($current_group.getGroupId(), "17842"))
    #foreach($banner in $banners)
         #set( $bannerXml = $saxReaderUtil.read($banner.getContent()))
         <li class="banner" id="banner-$velocityCount">
              <a href="$bannerXml.getRootElement().selectSingleNode(" dynamic-element[@name="link" ] dynamic-content").gettext()">
                 <img src="$bannerXml.getRootElement().selectSingleNode(" dynamic-element[@name="tablet-image" ] dynamic-content").getText()">
              </a>
         </li>
     #end


This gives me something like "9@public" for the href of the banner. Is there a way to convert this to a friendly url. Or is there another way to get field values in a Velocity template.

Thanks in advance, bob
thumbnail
chirag @ India, modificado 10 Anos atrás.

RE: Rendering Web Content in Theme

Regular Member Postagens: 129 Data de Entrada: 21/12/11 Postagens Recentes
bob brinks ,

refer this link

HTH
Chirag@India
bob brinks, modificado 10 Anos atrás.

RE: Rendering Web Content in Theme

New Member Postagens: 10 Data de Entrada: 20/06/13 Postagens Recentes
Thanks that worked great for me.
thumbnail
Ramkumar Chandran, modificado 10 Anos atrás.

RE: Rendering Web Content in Theme

Junior Member Postagens: 28 Data de Entrada: 15/11/11 Postagens Recentes
hi bob,

u can do as Chirag@India say,

or u can use follow code in portal_normal.vm file, which renders web content display portlet and use configuration to select the content

#set ($VOID = $velocityPortletPreferences.setValue('display-style', '1'))
#set ($VOID = $velocityPortletPreferences.setValue('portlet-setup-show-borders', 'false'))
#set ($instanceId = 'R3m7')
#set ($myPortletId = "56_INSTANCE_${instanceId}")$theme.runtime($myPortletId, '', $velocityPortletPreferences.toString())
 #set ($VOID = $velocityPortletPreferences.reset())



cheers,

Ramkumar Chandran