簡體   English   中英

Liferay Freemarker模板-在列表中使用索引

[英]Liferay freemarker template - Using index in list

我正在使用Liferay 6.2 EE。 我想通過執行以下代碼段來檢索自由標記Webcontent-Template中列表元素的索引:

 <#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但沒有成功...

不建議使用?index ,正確的語法為:

${cross_selling_index}

來源: Freemarker列表文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM