欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Typecho CSS3個(gè)性留言板之讀者墻頁(yè)面的實(shí)現(xiàn)方法

  發(fā)布時(shí)間:2015-08-24 14:48:56   作者:佚名   我要評(píng)論
這篇文章主要介紹了Typecho CSS3個(gè)性留言板讀者墻頁(yè)面的添加方法,需要的朋友可以參考下
效果圖如下:


看到文章的首圖相信大家都不陌生,可能其他博客的讀者墻或者留言薄頁(yè)面都見(jiàn)過(guò),挺簡(jiǎn)約的真實(shí)記錄博客的訪客,留下的足跡,便于回訪,這也算是博客里面互動(dòng)的一個(gè)重要依據(jù)或者途徑,下面就來(lái)說(shuō)說(shuō)在Typecho下該如何實(shí)現(xiàn)這麼個(gè)性的訪問(wèn)記錄:

首先、把下面代碼粘貼到當(dāng)前主題的functions.php頁(yè)面

PHP Code復(fù)制內(nèi)容到剪貼板
  1. //獲得讀者墻   
  2. function getFriendWall()      
  3. {      
  4.     $db = Typecho_Db::get();      
  5.     $sql = $db->select('COUNT(author) AS cnt''author''url''mail')      
  6.               ->from('table.comments')      
  7.               ->where('status = ?''approved')      
  8.               ->where('type = ?''comment')      
  9.               ->where('authorId = ?''0')      
  10.               ->where('mail != ?''admin@ben-lab.com')   //排除自己上墻   
  11.               ->group('author')      
  12.               ->order('cnt', Typecho_Db::SORT_DESC)      
  13.               ->limit('15');    //讀取幾位用戶的信息     
  14.     $result = $db->fetchAll($sql);      
  15.     
  16.     if (count($result) > 0) {      
  17.         $maxNum = $result[0]['cnt'];      
  18.         foreach ($result as $value) {      
  19.             $mostactive .= '<li><a target="_blank" rel="nofollow" href="' . $value['url'] . '"><span class="pic" style="background: url(http://1.gravatar.com/avatar/'.md5(strtolower($value['mail'])).'?s=36&d=&r=G) no-repeat; "></span><em>' . $value['author'] . '</em><strong>+' . $value['cnt'] . '</strong><br />' . $value['url'] . '</a></li>';          
  20.         }      
  21.         echo $mostactive;      
  22.     }      
  23. }  


其次、在主題目錄裏新建一個(gè)guestbook.php,粘貼以下代碼,當(dāng)然,新建頁(yè)面的名稱可以自己填寫(xiě),本篇是以guestbook為例,你懂的


復(fù)制代碼
代碼如下:

<?php
/**
* 自定義頁(yè)面模板
*
* @package custom
*/
?>

第三、打開(kāi)當(dāng)前主題的page.php,復(fù)制全部代碼.然后粘貼到guestbook.php,接著其次那步下面的代碼

第四、替換代碼,搜索下面代碼替換成再下面內(nèi)容


復(fù)制代碼
代碼如下:

<?php $this->content(''); ?>

替換成


復(fù)制代碼
代碼如下:

<div id="list-post">
<ul class='readers-list'>
<?php getFriendWall(); ?>
</ul></div>

第五、打開(kāi)主題的style.css,粘貼以下代碼


復(fù)制代碼
代碼如下:

.readers-list {line-height:16px;text-align:left;_zoom:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-o-text-}
.readers-list li{width:180px;float:left;*margin-right:-1px;list-style:none;}
.readers-list a,.readers-list a:hover strong{background-color:#f2f2f2;background-image:-webkit-linear-gradient(#f8f8f8,#f2f2f2);background-image:-moz-linear-gradient(#f8f8f8,#f2f2f2);background-image:linear-gradient(#f8f8f8,#f2f2f2);}
.readers-list a{position:relative;display:block;height:30px;margin:4px;padding:2px 4px 2px 44px;color:#999;overflow:hidden;border:#ccc 1px solid;border-radius:2px;box-shadow:#eee 0 0 2px;font-size:10px;line-height:14px;}
.readers-list .pic,.readers-list em,.readers-list strong{-webkit-transition:all .2s ease-out;-moz-transition:all .2s ease-out;transition:all .2s ease-out;}
.readers-list .pic{width:30px;height:30px;float:left;margin:0 8px 0 -40px;border-radius:2px;}
.readers-list em{color:#666;font-style:normal;margin-right:10px;font:bold 12px/16px microsoft yahei;}
.readers-list strong{color:#ddd;width:34px;text-align:right;position:absolute;right:6px;top:4px;font:bold 14px/16px microsoft yahei;}
.readers-list a:hover{border-color:#bbb;box-shadow:#ccc 0 0 2px;background-color:#fff;background-image:none;}
.readers-list a:hover .pic{opacity:.6;margin-left:0;}
.readers-list a:hover em{color:#EE8B17;font:bold 12px/36px microsoft yahei;}
.readers-list a:hover strong{color:#EE8B17;right:134px;top:0;text-align:center;border-right:#ccc 1px solid;height:34px;line-height:34px;}

第六、新建頁(yè)面或者編輯你的讀者墻頁(yè)面,點(diǎn)擊底部高級(jí)選項(xiàng),在自定義模版選擇"自定義頁(yè)面模版"發(fā)布即可!

相關(guān)文章

最新評(píng)論