2016-10-13 2 views
0

私はLiferay 6.2 EEを使用しています。私は、次のスニペット実行することにより、FreeMarkerののWebコンテンツ・テンプレートの中に私のリスト要素のインデックスを取得したい:Liferay freemarkerテンプレート - リスト内のインデックスを使用する

<#list cross_sellings_header.crossSellingsTile.getSiblings() as cross_selling> 
     ${cross_selling?index} 
     .... <#-- some implementation -->  
</#list> 

をしかし、私はエラーメッセージを取得:

Error on line 214, column 42, in template 20155#20195#ESHOP ARTIKEL Found index, expecting one of: chunk, is_date, is_hash, float, matches, time, number_to_datetime, byte, substring, is_transform, web_safe, iso_ms_nz, groups, seq_contains, iso, is_method, eval, iso_ms, iso_utc_m_nz, parent, capitalize, number, if_exists, is_directive

を私もindex_ofを試みたが、 ...

答えて

1

?indexは推奨されません。正しい構文は次のとおりです。

${cross_selling_index} 

出典: Freemarker list documentation

+0

パーフェクト。できます。あなたの助けに感謝します。 – HelmutSteiner

+1

'?index'は推奨されていません。それは '?index'で廃止予定の' ..._index'です。明らかに、Liferayの前記バージョンは、古いFreeMarkerバージョンを使用しています。 – ddekany

関連する問題