zoukankan      html  css  js  c++  java
  • typecho 文章归档调用

    <style>
    div {
        display: block;
    }
    .title {
        position: relative;
        margin: 0;
        line-height: 32px;
        font-size: 20px;
        border-bottom: 2px solid #eee;
    }
    article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary {
        display: block;
    }
    h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
        font-family: inherit;
        font-weight: 500;
        line-height: 1.1;
        color: inherit;
    }
    
    .archives h3 {
        font-size: 18px;
        margin: 4px 0 0 -120px;
        float: left;
    }
    .archives .item {
        padding: 20px 0 12px 120px;
        overflow: hidden;
        border-bottom: 1px solid #eee;
    }
    .archives .item:hover h3 {
        color: #ff4466;
    }
    .archives-list {
        list-style: none;
    }
    ul, ol {
        margin-top: 0;
        margin-bottom: 10px;
    }
    .archives-list time {
        margin-right: 5px;
        color: #999;
    }
    
    .archives-list .text-muted {
        float: right;
        font-size: 12px;
    }
    .text-muted {
        color: #999;
    }
    </style>
    <h1 class="title"><strong>文章归档</strong></h1>
    
    <?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
        $year=0; $mon=0; $i=0; $j=0;
        //$output = '<article class="archives"><ul class="archives-list">';
        while($archives->next()):
            $year_tmp = date('Y',$archives->created);
            $mon_tmp = date('m',$archives->created);
            $y=$year; $m=$mon;
            if ($mon != $mon_tmp && $mon > 0) $output .= '</ul></div></li></article>';  //结束拼接
            if ($year != $year_tmp && $year > 0) $output .= '</ul>';
            if ($year != $year_tmp) {
                $year = $year_tmp;
                //$output .= '<h3>'. $year .' 年</h3><ul>'; 
            }
            if ($mon != $mon_tmp) {
                $mon = $mon_tmp;
                $output .= '<article class="archives"><div class="item"><ul><h3>'.$year .'-'. $mon .'</h3>'; 
            }
            $output .= '<li><time>'.date('',$archives->created).'</time><a href="'.$archives->permalink .'">'. $archives->title .'</a> <span class="text-muted">('. $archives->commentsNum.')</span></li>'; //输出文章日期和标题
        endwhile;
        
        echo $output;
    ?>
  • 相关阅读:
    转 : jmeter分布式测试的坑
    Node.js 事件循环
    ubuntu 16.04 安装nodejs
    java中native的用法
    分布式与集群的概念区别
    IntegerToBinaryString
    Mysql InnoDB事务
    浅析Mysql InnoDB存储引擎事务原理
    Mysql数据库事务的隔离级别和锁的实现原理分析
    MySQL中MyISAM和InnoDB的区别
  • 原文地址:https://www.cnblogs.com/fan-bk/p/8417382.html
Copyright © 2011-2022 走看看