1 Star 1 Fork 0

朱某不爱说话 / typecho-Z001

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
archives.php 2.17 KB
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
朱某不爱说话 提交于 2024-06-01 14:22 . 1.0.3
<?php
/**
* 归档页
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('public/header.php');
?>
<div class="container">
<div class="card p-4 respond">
<?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?>
<div>文章总数:<?php $stat->publishedPostsNum() ?></div>
<div>分类总数:<?php $stat->categoriesNum() ?></div>
<div>评论总数:<?php $stat->publishedCommentsNum() ?></div>
<div>页面总数:<?php $stat->publishedPagesNum() ?></div>
<?php
$Month_E = array(
1 => "一月",
2 => "二月",
3 => "三月",
4 => "四月",
5 => "五月",
6 => "六月",
7 => "七月",
8 => "八月",
9 => "九月",
10 => "十月",
11 => "十一月",
12 => "十二月");
$this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
$year = 0;
$mon = 0;
$i = 0;
$j = 0;
$all = array();
$output = '';
while ($archives->next()):
$year_tmp = date('Y', $archives->created);
$mon_tmp = date('n', $archives->created);
$y = $year;
$m = $mon;
if ($mon != $mon_tmp && $mon > 0) $output .= '</div></div>';
if ($year != $year_tmp) {
$year = $year_tmp;
$all[$year] = array();
}
if ($mon != $mon_tmp) {
$mon = $mon_tmp;
array_push($all[$year], $mon);
$output .= "<div class='archive-title' id='arti-$year-$mon'><h3>$year-$Month_E[$mon]</h3><div class='archives archives-$mon' data-date='$year-$mon'>";
}
$output .= '<div class="brick"><a href="' . $archives->permalink . '" style="text-decoration:none;"><span class="time">' . date('m-d', $archives->created) . '</span style="color:#888;"> ' . $archives->title . '</a></div>';
endwhile;
$output .= '</div></div>';
echo $output;
$html = "";
$year_now = date("Y");
foreach ($all as $key => $value) {
$html .= "<li class='year' id='year-$key'><a href='#' class='year-toogle' id='yeto-$key'>$key</a><ul class='monthall'>";
for ($i = 12; $i > 0; $i--) {
if ($key == $year_now && $i > $value[0]) continue;
$html .= in_array($i, $value) ? ("<li class='month monthed' id='mont-$key-$i'>$i</li>") : ("<li class='month'>$i</li>");
}
$html .= "</ul></li>";
}
?>
</div>
</div>
<?php $this->need('public/footer.php'); ?>
PHP
1
https://gitee.com/zhuxucy/typecho-Z001.git
git@gitee.com:zhuxucy/typecho-Z001.git
zhuxucy
typecho-Z001
typecho-Z001
master

搜索帮助