-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
218 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; | ||
|
||
$this->need('header.php'); | ||
|
||
?> | ||
<main> | ||
<div class="wrap min"> | ||
<section class="board error-page"> | ||
<div class="post-title"> | ||
<h2>404</h2> | ||
<p>你正在寻找的文章已经不见了,不妨看看其他文章?</p> | ||
</div> | ||
<ul class="archives-list"> | ||
<?php | ||
|
||
function theme_random_posts(){ | ||
$defaults = array( | ||
'xformat' => '<li class="archive-post"><a class="archive-post-title" href="{permalink}">{title}</a><span class="date">{date}</span></li>' | ||
); | ||
|
||
$db = Typecho_Db::get(); | ||
$sql = $db -> select() -> from('table.contents') | ||
-> where('status = ?','publish') | ||
-> where('type = ?', 'post') | ||
-> limit(6) | ||
-> order('RAND()'); | ||
$result = $db->fetchAll($sql); | ||
|
||
foreach($result as $value){ | ||
$value = Typecho_Widget::widget('Widget_Abstract_Contents') -> filter($value); | ||
echo str_replace(array('{permalink}', '{title}', '{date}'), array($value['permalink'], $value['title'], date("Y-m-d", $value['created'])), $defaults['xformat']); | ||
} | ||
} | ||
|
||
theme_random_posts(); | ||
|
||
?> | ||
</ul> | ||
</section> | ||
</div> | ||
</main> | ||
|
||
<?php $this->need('footer.php'); ?> |
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
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
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
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
Oops, something went wrong.