我在CouchCMS中有一个代码重复生成重复的
<cms:folders masterpage='business.php' folder=k_folder_name>
<div class="big">
<cms:repeat count='2'>
<div class="small">
<a href="<cms:show k_folder_link />">
<img src="<cms:show k_folder_image />" />
<cms:show k_folder_name />
</a>
</div>
</cms:repeat>
</div>
</cms:folders>
上述代码的输出是:
<div class="big">
<div class="small">
<a href="http://localhost/cmi/business.php?f=2">
<img src="" />
folder2
</a>
</div>
<div class="small">
<a href="http://localhost/cmi/business.php?f=2">
<img src="" />
folder2
</a>
</div>
</div>
您可以看到名称folder2重复两次。因此,我得到的输出是输出相同的文件夹图像和文件夹名称。
我的目标是实现以下代码:
<div class="big">
<div class="small">
<a href="http://localhost/cmi/business.php?f=1">
<img src="" />
folder1
</a>
</div>
<div class="small">
<a href="http://localhost/cmi/business.php?f=2">
<img src="" />
folder2
</a>
</div>
</div>
显示folder1和folder2中的位置。在Couch编码中我需要做些什么改变?
答案 0 :(得分:2)
cms:folders标签本身将重复包含的内容,因为要列出的文件夹多次,因此不需要额外的cms:repeat标签。以下应该生成您正在寻找的代码
<div class="big">
<cms:folders masterpage='business.php'>
<div class="small">
<a href="<cms:show k_folder_link />">
<img src="<cms:show k_folder_image />" />
<cms:show k_folder_name />
</a>
</div>
</cms:folders>
</div>