以下是一级循环,循环列出栏目名称及栏目下的文章
<cms:folders orderby='weight' order='asc'> <h2 class="serises_folder"><span><cms:show k_folder_title /></span></h2> <div uk-grid class="uk-child-width-1-4@m uk-child-width-1-2 uk-grid-small product_list"> <cms:pages masterpage='product.php' folder=k_folder_name folder=k_folder_name paginate='1' limit='12' orderby='weight' order='asc'> <div> <figure class="uk-position-relative"> <a href="<cms:show k_page_link />"><img src="<cms:show thumb_image />" alt="<cms:show k_page_title />" title="<cms:show k_page_title />"></a> <figcaption class="uk-position-bottom-center"><cms:show xinghao /></figcaption> </figure> </div> <cms:if k_paginated_bottom> <div class="uk-width-1-1 pagelist"> <cms:paginator /> </div> </cms:if> </cms:pages> </div> </cms:folders>
如果遇到有2级栏目加栏目下的文章,可以使用以下代码:
<cms:folders masterpage="teacher.php" depth="1" orderby='weight' order='asc'> <h3 style="margin: 20px;"><span style="display: inline-block; padding: 3px 10px; color: #fff; background-color: #4c97d9;"><cms:show k_folder_title /></span></h3> <cms:folders masterpage="teacher.php" hierarchical="1" depth="2" childof=k_folder_name orderby='weight' order='asc'> <div class="uk-card uk-margin-top"> <div uk-grid class="uk-grid-small"> <div class="uk-width-1-5"> <h5><cms:show k_folder_title /></h5> </div> <div class="uk-width-4-5"> <ul uk-grid class="uk-child-width-1-4"> <cms:pages masterpage="teacher.php" orderby='weight' order='asc' folder=k_folder_name> <li> <figure> <div class="img_thumb"><img src="<cms:show _thumb_image />" alt="<cms:show k_page_title />"></div> <figcaption><cms:show k_page_title /></figcaption> </figure> </li> </cms:pages> </ul> </div> </div> </div> </cms:folders> </cms:folders>