王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

Typecho零丁挪用批评列表

Typecho零丁挪用批评列表


<?php/** * 零丁页面挪用批评列表 * * @author Mr.Asong * @link http://mrasong.com */$slug = "message";    //页面缩略名$limit = 10;    //挪用数目$length = 30;    //截取长度$ispage = true;    //true 输出slug页面批评,false输出别的一切批评$isGuestbook = $ispage ? " = " : " <> "; $db = $this->db;    //Typecho_Db::get();$options = $this->options;    //Typecho_Widget::widget('Widget_Options'); $page = $db->fetchRow($db->select()->from('table.contents')    ->where('table.contents.status = ?', 'publish')    ->where('table.contents.created < ?', $options->gmtTime)    ->where('table.contents.slug = ?', $slug)); if ($page) {    $type = $page['type'];    $routeExists = (NULL != Typecho_Router::get($type));    $page['pathinfo'] = $routeExists ? Typecho_Router::url($type, $page) : '#';    $page['permalink'] = Typecho_Common::url($page['pathinfo'], $options->index);     $comments = $db->fetchAll($db->select()->from('table.comments')        ->where('table.comments.status = ?', 'approved')        ->where('table.comments.created < ?', $options->gmtTime)        ->where('table.comments.type = ?', 'comment')        ->where('table.comments.cid ' . $isGuestbook . ' ?', $page['cid'])        ->order('table.comments.created', Typecho_Db::SORT_DESC)        ->limit($limit));     foreach ($comments AS $comment) {        echo '<li>';        echo '<a href="' . $page['permalink'] . "#comment-" . $comment['coid'] . '" title="' . $comment['text'] . '">';        echo Typecho_Common::subStr(strip_tags($comment['text']), 0, $length, '...') . '</a>';        echo '</li>';    }} else {    echo "<li>No Comments</li>";}//不需要完毕标志,并空一行


相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。