Widget Framework: Thread Thumbnails giống Tinh Tế

PVS

Super Moderator
Thành viên BQT
Tham gia
28/02/2015
Bài viết
16,829
Được Like
12,687
Chức năng: Thay ảnh đại diện bằng ảnh trong bài viết (mặc định là avatar của poster)

Cách làm:

- Yêu cầu phải sử dụng Widget Framework
- Upload đè (overwrite) file Threads.php vào /library/WidgetFramework/WidgetRenderer/
- Mở template wf_widget_threads thay toàn bộ code bằng:
Mã:
<style>
.xp-thread-top .clear{
clear:both;
}
.xp-thread-bottom .xp-left{
float:left;
}
.xp-thread-bottom .xp-right a{
font-size: 15px;
}
.sidebar .avatarList .avatar img {
width:60px;
height:60px;
}
</style>
<xen:if hascontent="true">
    <div class="avatarList">
        <ul>
            <xen:contentcheck>
           <xen:foreach loop="$new" value="$thread">
               <li>
               <div class="xp-thread-bottom">
<div class="xp-left">
<xen:if is="{$thread.attachment}">
<a href="{xen:link threads, $thread}" class="avatar" class="Tooltip">
<img src="{$thread.attachment}" alt="{$thread.title}" title="{$thread.title}" />
</a>
<xen:else />
<xen:avatar user="$thread" size="m" img="true" />
</xen:if>
</div>
                            <div class="xp-right">
   <xen:include template="wf_widget_threads_thread_title">
<xen:set var="$_showPrefix">{$widget.options.display.show_prefix}</xen:set>
</xen:include>
<div class="userTitle">{xen:phrase wf_x_posted, 'user={$thread.username}'} <xen:datetime time="{$thread.post_date}" /></div>
                            </div>
                        </div>
               </li>
           </xen:foreach>
           <xen:foreach loop="$recent" value="$thread">
               <li>
               <div class="xp-thread-bottom">
<div class="xp-left">
<xen:if is="{$thread.attachment}">
<a href="{xen:link threads, $thread}" class="avatar" class="Tooltip">
<img src="{$thread.attachment}" alt="{$thread.title}" title="{$thread.title}" />
</a>
<xen:else />
<xen:avatar user="$thread" size="m" img="true" />
</xen:if>
</div>
                            <div class="xp-right">
                           <xen:include template="wf_widget_threads_thread_title">
<xen:set var="$_showPrefix">{$widget.options.display.show_prefix}</xen:set>
<xen:set var="$_threadLink">{xen:if '{$visitor.user_id} > 0', {xen:link threads/unread, $thread}, {xen:link posts, {xen:array 'post_id={$thread.last_post_id}'}}}</xen:set>
</xen:include>
<div class="userTitle">{xen:phrase wf_x_replied, 'user={$thread.username}'} <xen:datetime time="{$thread.last_post_date}" /></div>
                            </div>
                        </div>
               </li>
           </xen:foreach>
           <xen:foreach loop="$popular" value="$thread">
               <li>
               <div class="xp-thread-bottom">
<div class="xp-left">
<xen:if is="{$thread.attachment}">
<a href="{xen:link threads, $thread}" class="avatar" class="Tooltip">
<img src="{$thread.attachment}" alt="{$thread.title}" title="{$thread.title}" />
</a>
<xen:else />
<xen:avatar user="$thread" size="m" img="true" />
</xen:if>
</div>
                            <div class="xp-right">
                           <xen:include template="wf_widget_threads_thread_title">
                                <xen:set var="$_showPrefix">{$widget.options.display.show_prefix}</xen:set>
</xen:include>
<div class="userTitle">{xen:phrase wf_x_posted, 'user={$thread.username}'} <xen:datetime time="{$thread.post_date}" /></div>
                            </div>
                        </div>
               </li>
           </xen:foreach>
                <xen:foreach loop="$mostReplied" value="$thread">
               <li>
               <div class="xp-thread-bottom">
<div class="xp-left">
<xen:if is="{$thread.attachment}">
<a href="{xen:link threads, $thread}" class="avatar class="Tooltip">
<img src="{$thread.attachment}" alt="{$thread.title}" title="{$thread.title}" />
</a>
<xen:else />
<xen:avatar user="$thread" size="m" img="true" />
</xen:if>
</div>
                            <div class="xp-right">
                           <xen:include template="wf_widget_threads_thread_title">
                                <xen:set var="$_showPrefix">{$widget.options.display.show_prefix}</xen:set>
</xen:include>
<div class="userTitle">{xen:phrase wf_x_posted, 'user={$thread.username}'}, {xen:phrase replies}: {xen:number $thread.reply_count}</div>
                            </div>
                        </div>
                   </li>
           </xen:foreach>
                <xen:foreach loop="$mostLiked" value="$thread">
                    <li>
               <div class="xp-thread-bottom">
<div class="xp-left">
<xen:if is="{$thread.attachment}">
<a href="{xen:link threads, $thread}" class="avatar" class="Tooltip">
<img src="{$thread.attachment}" alt="{$thread.title}" title="{$thread.title}" />
</a>
<xen:else />
<xen:avatar user="$thread" size="m" img="true" />
</xen:if>
</div>
                            <div class="xp-right">
                           <xen:include template="wf_widget_threads_thread_title">
                                <xen:set var="$_showPrefix">{$widget.options.display.show_prefix}</xen:set>
</xen:include>
<div class="userTitle">
                                {xen:phrase wf_x_posted, 'user=<a href="{xen:link 'members', {$thread}}">{$thread.username}</a>'},
                                {xen:phrase likes}: <a href="{xen:link 'posts/likes', {xen:array 'post_id={$thread.first_post_id}'}}" class="OverlayTrigger">{xen:number $thread.first_post_likes}</a>
                            </div>
                            </div>
                        </div>
                     </li>
           </xen:foreach>
           <xen:foreach loop="$polls" value="$thread">
               <li>
               <div class="xp-thread-bottom">
<div class="xp-left">
<xen:if is="{$thread.attachment}">
<a href="{xen:link threads, $thread}" class="avatar" class="Tooltip">
<img src="{$thread.attachment}" alt="{$thread.title}" title="{$thread.title}" />
</a>
<xen:else />
<xen:avatar user="$thread" size="m" img="true" />
</xen:if>
</div>
                            <div class="xp-right">
                           <xen:include template="wf_widget_threads_thread_title">
<xen:set var="$_showPrefix">{$widget.options.display.show_prefix}</xen:set>
</xen:include>
<div class="userTitle">{xen:phrase wf_x_posted, 'user={$thread.username}'} <xen:datetime time="{$thread.post_date}" /></div>
                            </div>
                        </div>
                      </li>
           </xen:foreach>
            </xen:contentcheck>
        </ul>
    </div>
</xen:if>

- Done

P/S: Các bạn có thể chỉnh kích thước ảnh đại diện ở width:80px; height:80px;


Nguồn: tailieu24h.net​
 

Đính kèm

  • Widget Framework Threads.zip
    4.3 KB · Lượt xem: 121

2L.Ohayo

Moderator
Thành viên BQT
Tham gia
08/03/2015
Bài viết
761
Được Like
835
cài thumbnails by waindigo vừa nhanh vừa đẹp cả trong forum view
 
  • Like
Reactions: THB

join8x

Private
Tham gia
24/04/2015
Bài viết
3
Được Like
2
Có demo không bạn, mình muốn hiển thị tin recentNews bên sidebar giống của tinhte.vn đó
 
  • Like
Reactions: THB

dcstylexf

Major
Tham gia
24/03/2015
Bài viết
2,005
Được Like
1,615
đã làm và đã lỗi với bản 2.6.0 :D
 

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mobile/Zalo: 0906081284

Telegram: anhanhxf

Chỉ nhận web nội dung lành mạnh

Nhà Tài Trợ

Mút Xốp Không Gian
Mút Sofa Không Gian
Top Bottom