-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpage-archives.php
47 lines (42 loc) · 1.48 KB
/
page-archives.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
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
/**
* 归档
*/
$this->need('header.php');
?>
<div class="post-container">
<div class="post-detail gt-bg-theme-color-first">
<article class="gt-post-content">
<h2 class="post-title"><?php $this->title(); ?></h2>
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
$year = 0; $mon = 0; $i = 0; $j = 0;
$output = '<div class="archives-container">';
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 .= '';
if ($year != $year_tmp && $year > 0) $output .= '';
if ($year != $year_tmp) {
$year = $year_tmp;
$output .= '<h2 class="year gt-c-cotent-color-first">' . $year . ' 年</h2>'; // 输出年份
}
if ($mon != $mon_tmp) {
$mon = $mon_tmp;
$output .= '<h4>' . $mon . ' 月</h4>'; // 输出月份
}
$output .= '<article class="post"><a href="' . $archives->permalink . '"><div class="post-title gt-c-content-color-first"> <small><b>' . $year . '.' . $mon . date('.d ', $archives->created) . ' · </b></small>' . $archives->title . '</div></a></article>'; // 输出文章日期和标题
endwhile;
$output .= '';
echo $output;
?>
</article>
</div>
</div>
<style>
.gt-post-content img {
margin: 0px auto !important;
}
</style>
<?php $this->need('footer.php'); ?>