forked from txperl/Story-for-Typecho
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-archive.php
62 lines (59 loc) · 2.53 KB
/
page-archive.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
/**
* 归档页面
*
* @package custom
*/
$this->need('header.php');
?>
<div class="container-fluid">
<div class="row">
<div id="main" class="col-12 clearfix" role="main">
<article class="posti" itemscope itemtype="http://schema.org/BlogPosting">
<!-- 总分类&标签 -->
<h3>Something</h3>
<div class="post-tags">
<!-- 分类 -->
<h4>Category</h4>
<?php $this->widget('Widget_Metas_Category_List', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($category); ?>
<ul class="a_tag">
<?php while ($category->next()) : ?>
<li rel="tag"><a href="<?php $category->permalink(); ?>"><?php $category->name(); ?></a></li>
<?php endwhile; ?>
</ul>
<!-- 标签 -->
<h4>Tag</h4>
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags); ?>
<ul class="a_tag">
<?php while ($tags->next()) : ?>
<li rel="tag"><a href="<?php $tags->permalink(); ?>"><?php $tags->name(); ?></a></li>
<?php endwhile; ?>
</ul>
</div>
<h3>Post</h3>
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
$year = 0;
$mon = 0;
$i = 0;
$j = 0;
$output = '<div id="archives">';
while ($archives->next()) :
$year_tmp = date('Y', $archives->created);
$mon_tmp = date('m', $archives->created);
$y = $year;
$m = $mon;
if ($year != $year_tmp && $year > 0) $output .= '</ul>';
if ($year != $year_tmp) {
$year = $year_tmp;
$output .= '<h4>' . $year . ' 年</h4><ul>'; //输出年份
}
$output .= '<li>' . date('m月d日:', $archives->created) . '<a href="' . $archives->permalink . '">' . $archives->title . '</a></li>'; //输出文章日期和标题
endwhile;
echo $output;
?>
</article>
</div>
</div>
</div>
<?php $this->need('footer.php'); ?>