Jump to content

  • Log in with Facebook Log in with Twitter Log in with Windows Live Log In with Google      Sign In   
  • Create Account
  • facebook
  • googleplus
  • twitter

Photo
- - - - -

Statistics giống IPB


  • Please log in to reply
No replies to this topic

#1 Rain

Rain

    Spam Happy

  • Admin
  • 270 posts

Posted 29 March 2013 - 05:14 PM

Đọc tiêu đề chắc các bạn đều hiểu, cái này là chúng ta tạo thống kê giống IPB cho Xenforo. Bắt đầu thôi:

Bước 1: Vào ACP >> Template >> Tạo mới một template với tên là footer_stats với đoạn code sau:



 

<xen:require css="footer_stats.css" /> <div id="board_stats" class="breadBoxBottom">     <ul class="ipsType_small ipsList_inline">         <span class="value">{xen:number $boardTotals.discussions}</span>{xen:phrase discussions}         <span class="value">{xen:number $boardTotals.messages}</span>{xen:phrase messages}         <span class="value">{xen:number $boardTotals.users}</span>{xen:phrase members_count}         <span class="value"><xen:usernameuser="$boardTotals.latestUser" /></a></span>{xen:phrase latest_member}     </ul> </div> <div class="borderwrapper">     <div class="stats_body">         <h3 class="stats_title_right"><a href="online/" class="Tooltip" title="See all online users">{xen:phrase online_now_x_members_y_guests_z, 'total={xen:number $onlineUsers.total}', 'members={xen:number $onlineUsers.members}', 'guests={xen:number $onlineUsers.guests}'}</a></h3>             <div id="stats_content">                 <xen:if is="{$onlineUsers.records}">             <ol class="listInline">             <xen:foreach loop="$onlineUsers.records" value="$user" i="$i">                 <xen:if is="{$i} <= {$onlineUsers.limit}">                     <li>                     <xen:if is="{$user.user_id}">                         <a href="{xen:link members, $user}"                             class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{$user.username}</a><xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>                     <xen:else />                         {xen:phrase guest}<xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>                     </xen:if>                     </li>                 </xen:if>             </xen:foreach>             <xen:if is="{$onlineUsers.recordsUnseen}">                 <li class="moreLink">... <a href="{xen:link online}" title="{xen:phrase see_all_visitors}">{xen:phrase and_x_more, 'count={xen:number $onlineUsers.recordsUnseen}'}</a></li>            </xen:if>             </ol>             </xen:if>         <br />         <ul>             <li>                 <span style="font-weight: bold; color: red;">Administrator</span></a> |                 <span style="font-weight: bold; color: green;">Moderator</span> |                 <span style="color: black; font-weight: bold;">Members</span> |                 <span style="color: violet; font-weight: bold;">Bots</span>             </li>         </ul>         </div>     </div> </div>

Bước 2: Tạo tiếp một template với tên footer_stats.css với đoạn code sau:

 

 

 

#board_stats ul {         text-align: center;         font: normal 11px tahoma,helvetica,arial,sans-serif; } #board_stats li {         font: normal 11px tahoma,helvetica,arial,sans-serif;         margin-right: 20px; } #board_stats .value {         background: none repeat scroll 0 0 url(rgba.php?r=0&g=0&b=0&a=25); background: none repeat scroll 0 0 rgba(0, 0, 0, 0.1); _filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000,endColorstr=#19000000);font: normal 11px tahoma,helvetica,arial,sans-serif;         border-radius: 3px 3px 3px 3px; -webkit-border-radius: 3px 3px 3px 3px; -moz-border-radius: 3px 3px 3px 3px; -khtml-border-radius: 3px 3px 3px 3px;         box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset, 0 1px 0 #FFFFFF; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset, 0 1px 0 #FFFFFF; -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset, 0 1px 0 #FFFFFF; -khtml-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset, 0 1px 0 #FFFFFF;        color: #222222;         display: inline-block;         font-weight: bold;         margin-right: 3px;         padding: 3px 7px;         text-shadow: 0 0 0 transparent, 0 1px 0 rgba(255, 255, 255, 0.6); } .borderwrapper {         overflow: hidden;         border: 1px solid         rgb(215, 215, 215);         border-radius: 10px;         -webkit-border-radius: 10px;         -moz-border-radius: 10px;         -khtml-border-radius: 10px;         padding: 5px; } .stats_body {         width: 100%;         float: left; }.stats_title_left, .stats_title_center, .stats_title_right {         overflow: hidden;         background:         #F7F7F7;         border-bottom: 1px solid         #E0E0E0;         color:         rgb(100,100,100);         font: normal 11px tahoma,helvetica,arial,sans-serif;         text-align: left;         margin: 0px;         font-size: 11px;         font-weight: bold;         padding: 3px 10px; } #stats_content {         font: normal 11px tahoma,helvetica,arial,sans-serif;         font-size: 11px;         padding: 5px 10px; }

 

Bước 3: Mở template forum_list và tìm dòng:
 


 

<xen:hook name="forum_list_nodes">     <xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if> </xen:hook>

Thêm vào phía trên đoạn mã sau:

 

 


 

<xen:include template="footer_stats" />

 

Thế là xong.Chúc các bạn thành công

 

Demo nha:

 

Attached File  33kan36.png   4.08K   0 downloads



 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users