Tutorial 2x Tạo thống kê bài viết không cần addon

secpol

MasterCorporal
Tham gia
10/06/2016
Bài viết
223
Được Like
134
Mục tiêu chúng ta sẽ tạo ra 1 mục thống kê bài viết như hình dưới:

static.jpg

Chuẩn bị: Chúng ta cần cài thêm addon [Widget] Popular threads and posts để có thêm widget Bài viết xem nhiều.

Bước 1:
Tạo 4 widget với widget key: YHBS_forumList_newThreads, YHBS_forumList_newPosts, YHBS_forumList_mostView, YHBS_forumList_newMembers nhưng Display in positions không chọn.

Bước 2:
Vào template forum_list

Tìm:
Mã:
<xf:widgetpos id="forum_list_sidebar" position="sidebar" />

Thêm vào bên dưới:
Mã:
<div class="YHBS_forumList_block">
    <div class="YHBS_block_wrapper">
        <xf:widget key="YHBS_forumList_newThreads" />
        <xf:widget key="YHBS_forumList_newPosts" />
        <xf:widget key="YHBS_forumList_mostView" />
        <xf:widget key="YHBS_forumList_newMembers" />
    </div>
</div>

Bước 3:
Vào template extra.less và thêm đoạn code bên dưới:

Mã:
/***** YHBS Forum Statistics *****/
.YHBS_forumList_block
{
    margin-bottom: 15px;
  
    .YHBS_block_wrapper
    {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-around;
      
        .block
        {
            width: ~"calc(50% - 10px)";
            margin-bottom: 10px;
          
            .block-container
            {
                box-shadow: none;
                overflow: hidden;
                margin-left: auto;
                margin-right: auto;
                height: 100%;
              
                .listHeap
                {
                    display: flex;
                    flex-wrap: wrap;
                    justify-content: space-between;
                    margin: 0 auto;
                  
                    > li
                    {
                        margin-left: 5px;
                        margin-right: 5px;
                        margin-top: 10px;
                    }
                }
              
                .block-minorHeader
                {
                    background-color: @xf-paletteColor4;
                    color: @xf-paletteNeutral1;
                }
              
                .contentRow
                {
                    align-items: center;
                  
                    .contentRow-main
                    {
                        > a
                        {
                            display: block;
                            max-width: 100%;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            text-decoration: none;
                            white-space: nowrap;
                            font-size: 100%;
                        }
                  
                        .contentRow-minor
                        {
                            display: none;
                        }
                    }
                }
            }
        }
    }
}

@media (max-width: 600px)
{
    .YHBS_forumList_block .YHBS_block_wrapper .block
    {
        width: 100%;
    }
}
/***** YHBS Forum Statistics *****/


Note:
  • Bài viết có tham khảo nguồn ở xfv2.com
  • Cụm từ YHBS bạn có thể thay bằng 1 cái tên khác tùy bạn
 

Đính kèm

  • DL6-MLTP-1.1.0.zip
    72.3 KB · Lượt xem: 40

huynhvantam123

Corporal
Tham gia
28/08/2018
Bài viết
164
Được Like
43
mong được hướng dẫn chi tiết hơn. Làm mò mẫm theo bài chưa xong dc bước 1. Tới YHBS_forumList_mostView là ko làm dc nữa :(
 

NDK

MasterSergeant
Tham gia
16/03/2015
Bài viết
830
Được Like
743
Tạo 4 widget với widget key: YHBS_forumList_newThreads, YHBS_forumList_newPosts, YHBS_forumList_mostView, YHBS_forumList_newMembers nhưng Display in positions không chọn.

Download cái add-on chủ topic đính kèm rồi cài đặt, sau đó vào tạo Widget mới như sau :
- Widget definition chọn là New theards, sau khi tạo thì điền Widget key tương ứng :YHBS_forumList_newThreads
- Widget definition chọn là New Posts, sau khi tạo thì điền Widget key tương ứng
YHBS_forumList_newPosts
- Widget definition chọn là Most viewed threads, sau khi tạo thì điền Widget key tương ứng YHBS_forumList_mostView
- Widget definition chọn là Newest members, sau khi tạo thì điền Widget key tương ứng YHBS_forumList_newMembers
Xem thử 1 ví dụ ở hình dưới rồi tương tự cho các phần
Screenshot (35).png
Screenshot (36).png

Mấy phần dưới thì đơn giản rồi, cứ từng bước tạo và sửa code trong template
 

huynhvantam123

Corporal
Tham gia
28/08/2018
Bài viết
164
Được Like
43
Tạo 4 widget với widget key: YHBS_forumList_newThreads, YHBS_forumList_newPosts, YHBS_forumList_mostView, YHBS_forumList_newMembers nhưng Display in positions không chọn.

Download cái add-on chủ topic đính kèm rồi cài đặt, sau đó vào tạo Widget mới như sau :
- Widget definition chọn là New theards, sau khi tạo thì điền Widget key tương ứng :YHBS_forumList_newThreads
- Widget definition chọn là New Posts, sau khi tạo thì điền Widget key tương ứng
YHBS_forumList_newPosts
- Widget definition chọn là Most viewed threads, sau khi tạo thì điền Widget key tương ứng YHBS_forumList_mostView
- Widget definition chọn là Newest members, sau khi tạo thì điền Widget key tương ứng YHBS_forumList_newMembers
Xem thử 1 ví dụ ở hình dưới rồi tương tự cho các phần View attachment 28461 View attachment 28462
Mấy phần dưới thì đơn giản rồi, cứ từng bước tạo và sửa code trong template
à thì ra có cái em chọn sai nó bảo key gì đó đã tồn tại. Giờ tạo 4 cái ngọt rồi
 

thuyet951

MasterCorporal
Tham gia
01/04/2016
Bài viết
312
Được Like
427
thế mà bảo k cần addon -_-
Có cần add-ons đâu, cái cài thêm kia chỉ là thêm các nhiều widgets lấy bài hơn thôi, nếu bác thích có thể dùng widget mặc định có sẳn trên xenforo cũng đủ rồi.
 

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

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mr. Tuấn

Mobile/Zalo: 0988 488 096

Telegram: bluekpro

Email: [email protected]

Nhà Tài Trợ

Mút Xốp Không Gian
pallet Thịnh Phát
Top Bottom