惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

飞絮落叶雪 - typecho

Typecho 几个小插件分享 Tpyecho 集成 Artalk 折腾小记 独立博客自省问卷15题 您的邮箱被管理员屏蔽无法评论 typecho CMS主题下载 垃圾站复活记 修改typecho的md解析器支持脚注 给博客添加几个小功能 typecho显示exif信息
整了一个typecho归档页面
Mr.He · 2016-11-11 · via 飞絮落叶雪 - typecho

原主题的归档页面不是我的菜,而网上的归档插件,在我的博客了发神经,时好时坏,无奈之下,只好自己参照各种版本的教程,还有官网的wiki,整出一个这样的归档页面来,没有加载js,全部就是几行代码而已,喜欢的同学直接拿去,不谢!

20161111105057.png

<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php   
/**  
    * archives  
    *  
    * @package custom  
    */  
$this->need('header.php'); ?>   
    <div id="mainbox2">   
            <div class="post"  id="post-<?php $this->cid(); ?>">   
            <h1><span class="post-title"><a href="<?php $this->permalink() ?>" title=""><?php  $this->title() ?></a></span></h1>   
            <div class="clear"></div>   
            <div class="entry">   
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
    $year=0; $mon=0; $i=0; $j=0;
    $output = '<div class="post-content cf">';
    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></li>';
        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 .= '<li><span>'. $year .' 年'. $mon .' 月</span><ul>';
        }
        $output .= '<li>'.date('d日: ',$archives->created).'<a href="'.$archives->permalink .'">'. $archives->title .'</a> ('. $archives->commentsNum.')</li>';
    endwhile;
    $output .= '</ul></li></ul></div>';
    echo $output;
?>          <div class="clear"></div>   
            </div>   
        </div>   
    </div>
<?php $this->need('footer.php'); ?>

另外把css美化一下,各位参照自己的主题动手修改,我的css如下:

div#mainbox2 {
    position: relative;
    margin: 9% auto 5%;
    padding: 1% 3% 2%;
    max-width: 800px;
    width: 100%;
    background-color: #fff;
    -webkit-box-shadow: 1px 2px 3px #ddd;
    box-shadow: 1px 2px 3px #ddd;
    -webkit-border-radius: 3px;
    border-radius: 3px;
}