Liferay velocity template showing only first image for repeatable image field

纵饮孤独 提交于 2020-01-17 04:59:26

问题


I have created structures and template for adding the events.

The input I have taken is:

  1. year with month,
  2. image for the event,
  3. description for the event.

All the data is displaying properly except image. The image which I have given first is displaying for each event.

Can any one help me?

<root available-locales="en_US" default-locale="en_US">
    <dynamic-element dataType="html" fieldNamespace="ddm" indexType="keyword" name="about_fe" readOnly="false" repeatable="false" required="false" showLabel="true" type="ddm-text-html" width="small">
        <meta-data locale="en_US">
            <entry name="label">
                <![CDATA[about fundraising]]>
            </entry>
            <entry name="predefinedValue">
                <![CDATA[]]>
            </entry>
            <entry name="tip">
                <![CDATA[]]>
            </entry>
        </meta-data>
    </dynamic-element>
    <dynamic-element dataType="html" fieldNamespace="ddm" indexType="keyword" name="year_fe" readOnly="false" repeatable="true" required="false" showLabel="true" type="ddm-text-html" width="small">
        <dynamic-element dataType="image" fieldNamespace="wcm" indexType="keyword" name="image_fe" readOnly="false" repeatable="false" required="false" showLabel="true" type="wcm-image" width="">
            <meta-data locale="en_US">
                <entry name="label">
                    <![CDATA[select image for fundraise event]]>
                </entry>
                <entry name="predefinedValue">
                    <![CDATA[]]>
                </entry>
                <entry name="tip">
                    <![CDATA[]]>
                </entry>
            </meta-data>
        </dynamic-element>
        <dynamic-element dataType="html" fieldNamespace="ddm" indexType="keyword" name="desc_fe" readOnly="false" repeatable="false" required="false" showLabel="true" type="ddm-text-html" width="small">
            <meta-data locale="en_US">
                <entry name="label">
                    <![CDATA[enter description for the event]]>
                </entry>
                <entry name="predefinedValue">
                    <![CDATA[]]>
                </entry>
                <entry name="tip">
                    <![CDATA[]]>
                </entry>
            </meta-data>
        </dynamic-element>
        <meta-data locale="en_US">
            <entry name="label">
                <![CDATA[enter the year and month]]>
            </entry>
            <entry name="predefinedValue">
                <![CDATA[]]>
            </entry>
            <entry name="tip">
                <![CDATA[]]>
            </entry>
        </meta-data>
    </dynamic-element>
</root>

The following is my template code:

#if (!$year_fe.getSiblings().isEmpty())
    #foreach ($cur_year_fe in $year_fe.getSiblings())

    <div class="pto_fund">

        <div class="my_time">
            <div  class="mysection1"><h5>$cur_year_fe.getData()</h5></div>
        </div>

        <div  class="mysection2">
            <img src="$cur_year_fe.image_fe.getData()" height="200px" width="230px"/>
        </div>

        <div  class="mysection3">$cur_year_fe.desc_fe.getData()</div>
    </div>

    <div class="clear">
    </div>
    #end
#end

Sample output


回答1:


I think you probably hit below liferay issues :-

https://issues.liferay.com/browse/LPS-43553

https://issues.liferay.com/browse/LPS-51440

Probably the work around would be to move "image_fe" to upper level (start with a repeatable image and so on).

HTH



来源:https://stackoverflow.com/questions/30137395/liferay-velocity-template-showing-only-first-image-for-repeatable-image-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!