留言板

images repeat in asset-publisher custom template

thumbnail
parviz makari,修改在8 年前。

images repeat in asset-publisher custom template

New Member 帖子: 6 加入日期: 14-1-3 最近的帖子
Hi guys,

I created a custom template for asset publisher , I access my web-content image field using below code:

#set( $xPathSelector = $saxReaderUtil.createXPath("dynamic-element[@name='image']") )
#set( $image= $xPathSelector.selectSingleNode($rootElement).getStringValue() )

I have 3 web-content which only one of them has image....when I place asset publisher in my test web page it renders thumbnail image for all of my web-content...while it should render thumbnail image for web-content that has an image......I also don't want use web-content small image....

Any suggestion!!!!
thumbnail
Ravi Kumar Gupta,修改在8 年前。

RE: images repeat in asset-publisher custom template

Liferay Legend 帖子: 1302 加入日期: 09-6-24 最近的帖子
Not sure if this will help.. but try unsetting the $image variable or set it to blank after rendering one web content details.
thumbnail
Parviz Makari,修改在8 年前。

RE: images repeat in asset-publisher custom template

New Member 帖子: 6 加入日期: 14-1-3 最近的帖子
Ravi thanks for your response,but I solved it by accessing my web-content image field using below code :

#foreach( $dynamicElement in $rootElement.elements() )
#if( "image" == $dynamicElement.attributeValue("name") )
#set( $img = $dynamicElement.element("dynamic-content").getText())
#end
#end