summaryrefslogtreecommitdiff
path: root/page-archive.php
blob: bcff37586d5b4a45d2fe90958c55ff4d55643ead (plain)
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
<?php
/**
 * 归档页面
 *
 * @package custom
 */

if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('includes/header.php');
?>
<div class="col-12" id="main" role="main">
	<div id="search">
	  	<input type="text" placeholder="搜索博客文章" name="" id="input_search" value="" />
        <a id="search-button"><span class="iconfont">&#xe82e;</span></a>
	</div>
	<div id="tag">
	  <?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags);
	   if($tags->have()): ?>
	   <h2>标签云</h2>
	   <ul class="tags-list">
		<?php while ($tags->next()): ?>
    		<li><a href="<?php $tags->permalink(); ?>" rel="tag" title="<?php $tags->count(); ?> 个话题">#<?php $tags->name(); ?></a></li>
		<?php endwhile; ?>
    	   </ul>
	   <?php endif; ?>
	</div>
	<br>
	<div class="archive-post" id="post-list">
	<?php
    $archives = Matcha::archives($this);
    $number = 0;
    foreach($archives as $year => $posts) {
        $open = ($number === 0) ? NULL : ' closed';
		echo '<h2 class="archive-year">'.$year.' 年 <button id="archive-button-'.$year.'" class="archive-button'.$open.'"><span class="iconfont">&#xe749;</span></button></h2>';
        echo '<ol id="archive-list-'.$year.'" class="archive-list'.$open.'">';
    		foreach($posts as $created => $post) {
                if ($post['created'] > time()) continue;
        		echo '<li class="archive-item"><a href="'.$post['permalink'].'" class="no-line">
				<span class="archive-date">'.date('m-d', $created).'</span> ·
				'.$post['title'].'
				</a></li>';
			}
        echo '</ol>';
        $number++;
      }?>
	</div>
</div><!-- end #main-->

<?php $this->need('includes/footer.php'); ?>