我想顯示2個圖像,並跳過一個,如果它符合下列條件,(<cfif myDir.name eq property_mainimage>
工作正常,然後繼續到下一個圖像和顯示下一個圖像,直到我有一個總共有2張圖像,但是如果標準圖像在第5行中顯示,則循環顯示3張圖像,當標準圖像稱爲第1行時,顯示2張圖像的ColdFusion CFLOOP跳過行或改變的環路endRow
似乎沒有跳過行在cfloop?
我已經嘗試<cfif counter gt 3 > <cfabort>
哪些作品,但它顯示的3條圖像依然是標準圖像是在一個大於3行。下面是我正在與...
<cfdirectory directory="C:\Domains\domain.com\wwwroot\uploads\images\#property_ID#\" filter="*.jpg" name="myDir" type="file" sort="datelastmodified">
<ul>
<cfset counter = 0>
<cfset endrowvalue = 3 >
<cfloop query="myDir" endRow="#endrowvalue#">
<cfset counter = counter +1 >
<li>
<cfif right(myDir.name,4) is ".jpg">
<cfif fileexists("C:\Domains\ domain.com\wwwroot\uploads\ images\#property_ID#\#left(mydir.name,len(myDir.name)-4)#.jpg")>
<cfif myDir.name eq property_mainimage>
DO NOT SHOW THIS IMAGE
<cfelse>
<cfset endrowvalue = 1 >
<cfset myDir.endRow = 1 >
test #endrowvalue#
test #counter# <img src="#request.root#uploads/images/#property_ID#/#myDir.name#" border="0" width="230px" style="margin-bottom:15px;" />
</cfif>
</cfif>
</cfif>
</li>
</cfloop>
</ul>
任何幫助將是非常讚賞。
優秀,非常感謝馬特,該訣竅。 – elixireu