迅睿 CMS 列表页实现数据按不同月份归类

用户需求:年作为二级栏目,访问栏目页面时自动加载该年份全部内容,按照文章发布月份进行分组归类展示。

注意:此方法适合企业站发展历程等用途,不过文章多最好别涉及分页,怕被截断。(如果需要另外开发功能,可联系站长:2305035643)

实现效果如下:

 

代码示例如下:

<main id="main">
    {template "comm/inner_banner.html"}

    <section class="PublicStyleFramework">
        <div class="container">
            <div class="out">
                {template "comm/left.html"}

                <div class="right">
                    {template "comm/position.html"}

                    {php $last_month = '';}
                    <div class="mark_pages">
                        {module catid=$catid order=inputtime DESC pagesize=200}
                        {php $month = dr_date($t.inputtime, 'Y年m月');}
                        {if $month != $last_month}
                        {if $last_month != ''}
                    </div>
                </div>
                {/if}
                <div class="Mark_list">
                    <div class="title">
                        <img src="{THEME_PATH}chuanchengyun/images/date.png" alt="">
                        <span>{$month}</span>
                    </div>
                    <div class="list">
                        {php $last_month = $month;}
                        {/if}
                        <a href="{$t.url}" class="item">
                            <div class="img"><img src="{dr_thumb($t.thumb)}" alt=""></div>
                            <div class="text">
                                <h3>{$t.title}</h3>
                                <div class="Moer_box">
                                    <span>{dr_date($t.inputtime, 'Y年m月d日')}</span>
                                    <span>了解更多 <img src="{THEME_PATH}chuanchengyun/images/9790.png" alt=""></span>
                                </div>
                            </div>
                        </a>
                        {/module}
                        {if $last_month != ''}
                    </div>
                </div>
                {/if}
            </div>

        </div>
        </div>
        </div>
    </section>

</main>

 

阅读全文
原文链接:https://www.mubanbaba.com/219.html,转载请注明出处。
0

评论0

显示验证码
没有账号?注册  忘记密码?

社交账号快速登录