-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: refine and add page-archive
- Loading branch information
Showing
4 changed files
with
294 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,36 @@ | ||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) { | ||
exit; | ||
} | ||
<?php | ||
/** | ||
* Archives | ||
* | ||
* @package custom | ||
*/ | ||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; | ||
$this->need('header.php'); | ||
?> | ||
<?php $this->need('header.php');?> | ||
<!-- content start --> | ||
<div class="am-g am-g-fixed blog-fixed blog-content"> | ||
<div class="am-u-sm-12"> | ||
<article class="am-article blog-article-p"> | ||
<div clss="post-archive" itemprop="articleBody"> | ||
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000' | ||
)->to($archives); | ||
$year = 0; | ||
$mon = 0; | ||
$i = 0; | ||
$j = 0; | ||
$i = 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) { | ||
$output .= '</section>'; | ||
} | ||
if ($mon != $mon_tmp) { | ||
$output .= '</section>'; | ||
} | ||
if ($year != $year_tmp) { | ||
$year = $year_tmp; | ||
$output .= '<section id="year" style="overflow:hidden;">'; | ||
$output .= '<h5>' . $year . '</h5>'; //输出年份 | ||
} | ||
if ($mon != $mon_tmp) { | ||
$mon = $mon_tmp; | ||
$output .= '<section id="mon" style="overflow:hidden;">'; | ||
$output .= '<span style="text-align:right;"><h6>' . date('F', | ||
$archives->created) . '</h6></span>'; //输出月份 | ||
} | ||
$output .= '<div class="arc-t"><div class="arc-tile"><small><a href="' | ||
. $archives->permalink . '">' . $archives->title . | ||
'</a></small> <span class="arc-date">' . date('M j, Y', $archives->created) . | ||
'<span></div></div>'; //输出文章日期和标题 | ||
endwhile; | ||
echo $output; | ||
?> | ||
</div> | ||
</article> | ||
|
||
<?php $this->need('commends.php');?> | ||
|
||
<hr> | ||
</div> | ||
<div class="container-fluid archive-page clearfix"> | ||
<?php | ||
$stat = Typecho_Widget::widget('Widget_Stat'); | ||
$this->widget('Widget_Contents_Post_Recent', 'pageSize='.$stat->publishedPostsNum)->to($archives); | ||
$year=0; $mon=0; $i=0; $j=0; | ||
$output = '<div class="categorys-item">'; | ||
while($archives->next()){ | ||
$year_tmp = date('Y',$archives->created); | ||
$mon_tmp = date('m',$archives->created); | ||
$y=$year; $m=$mon; | ||
if ($year > $year_tmp || $mon > $mon_tmp) { | ||
$output .= '</div></div>'; | ||
} | ||
if ($year != $year_tmp || $mon != $mon_tmp) { | ||
$year = $year_tmp; | ||
$mon = $mon_tmp; | ||
$output .= '<div class="categorys-title">'.date('M Y',$archives->created).'</div><div class="post-lists"><div class="post-lists-body">'; | ||
} | ||
$output .= '<div class="post-list-item"><div class="post-list-item-container"><div class="item-label"><div class="item-title"><a href="'.$archives->permalink .'">'. $archives->title .'</a></div><div class="item-meta clearfix"><div class="item-meta-date"> '.date('M j, Y',$archives->created).' </div></div></div></div></div>'; | ||
} | ||
$output .= '</div></div></div>'; | ||
echo $output; | ||
?> | ||
</div> | ||
<!-- content end --> | ||
|
||
<?php $this->need('footer.php');?> | ||
<?php $this->need('footer.php'); ?> |