我想根据传递给 cfdirectory 的过滤条件吐出略有不同的 html。
这是我的 cfml:
<cfdirectory
directory="#dirName#"
name="fileList"
action="list"
type="file"
filter="*.jpg|*.jpeg|*.png|*.gif|*.mp4"
>
<ul id="content">
<cfoutput>
<cfloop query="fileList">
<cfif filter NEQ '*.mp4'> // I guess this is not possible and is throwing the error
<li class="content image">
<img src="img/#name#" />
</li>
</cfif>
<cfelse>
<li class="video image">
<video controls="controls">
<source src="img/#name#" type="video/mp4">
</video>
</li>
</cfif>
</cfloop>
</cfoutput>
</ul>
我想我不能简单地访问 cfif
中的 filter
,但我不确定如何给它设置皮肤。是否需要存储在循环外的变量中?
非常感谢任何帮助
最佳答案
您可以简单地执行以下操作。
<cfif listLast(fileList.name, '.') NEQ 'mp4'>
关于html - cfdirectory 根据过滤器输出不同的 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61940140/