Typecho归档页面

CludeChn
2013-03-08 / 0 评论 / 728 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2013年03月08日,已超过4038天没有更新,若内容或图片失效,请留言反馈。

以下是具体的代码, 复制到一个php中, 单独做个模板然后就可以用了, 如果还想速度快点, 可以写一个缓。

<?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 ($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 class="al_year">'. $year .' 年</h3><ul class="al_mon_list">'; //输出年份
		}
		if ($mon != $mon_tmp) {
			$mon = $mon_tmp;
			$output .= '<li><span class="al_mon">'. $mon .' 月</span><ul class="al_post_list">'; //输出月份
		}
		$output .= '<li>'.date('d日: ',$archives->created).'<a href="'.$archives->permalink .'">'. $archives->title .'</a> <em>('. $archives->commentsNum.')</em></li>'; //输出文章日期和标题
	endwhile;
	$output .= '</ul></li></ul></div>';
	echo $output;
?>

转自:http://mufeng.me/typecho-archives.html

0

评论 (0)

取消