-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtpl-archive.php
executable file
·40 lines (32 loc) · 1.14 KB
/
tpl-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
<?php
/**
* 日志归档
*
* @package custom
*
*/
?>
<?php $this->need('header.php'); ?>
<div class="mainbody">
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=100000')->to($archives);
$output = '';
$posts_rebuild = array();
while($archives->next()):
$post_year = date('Y',$archives->created);
$post_mon = date('m',$archives->created);
$posts_rebuild[$post_year][$post_mon][] = '<li style="list-style-type:circle;padding:5px;">- '.date('d',$archives->created).' * <a href="'. $archives->permalink .'">'. $archives->title .'</a></li>';
endwhile;
foreach ($posts_rebuild as $key => $value) {
$year = $key;
foreach ($value as $key_m => $value_m) {
$output .= '<h3 style="margin-top:0;padding-top:8px; text-align:center">' . $year . ' - ' . $key_m . '</h3><ul>';
foreach ($value_m as $key => $value_d) {
$output .= $value_d;
}
$output .= '</ul>';
}
}
echo $output;
?>
</div>
<?php $this->need('footer.php'); ?>