Add a random quote block to the sidebar - Thêm một block trích dẫn ngẫu nhiên vào sidebar 1.0

PVS

Super Moderator
Thành viên BQT
Tham gia
28/02/2015
Bài viết
16,829
Được Like
12,688
Add a random quote block to the sidebar - Thêm một block trích dẫn ngẫu nhiên vào sidebar 1.0

Bước 1: Giải nén và tải lên các tập tin đính kèm vào thư mục /data của bạn để nó cho thấy là /data/RandomQuote
Bước 2: Dán đoạn code sau trong PAGECONTAINER trước </head>
Mã:
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function($) {
    $.get('./data/RandomQuote/quotes.txt', function(data) {
        var quotes = data.split("\@");
        var idx = Math.floor(quotes.length * Math.random());
        $('.quotes').html(quotes[idx]);
    });
});
</script>

Bước 3: Thêm vào EXTRA.css
Mã:
.bqstart {
    float: left;
    font-size: 300%;
    margin-right: 5px;
    height: 15px;
}

.bqend {
    float: right;
    font-size: 300%;
    margin-top: -20px;
    height: 15px;
}
  .bq {
    font-family: "WCManoNegraBtaRegular", Arial, sans-serif;
    font-size: 180%;
    margin-right: 15px;
}
@font-face {
    font-family: 'WCManoNegraBtaRegular';
    src: url('./data/RandomQuote/WCManoNegraBta-webfont.eot');
    src: local('☺'), url('./data/RandomQuote/WCManoNegraBta-webfont.woff') format('woff'), url('./data/RandomQuote/WCManoNegraBta-webfont.ttf') format('truetype'), url('./data/RandomQuote/WCManoNegraBta-webfont.svg#webfonte6F4DwaZ') format('svg');
}

Bước 4: Tạo một template mới được gọi là random_quote, và thêm vào đoạn code sau:
Mã:
<div class="secondaryContent">
<div class="bqstart">&#8220;</div>
<div class="quotes bq" style="padding-top: 10px; padding-right: 5px;"></div>
<div class="bqend">&#8221;</div>
</div>

Nếu bạn muốn có một tiêu đề trên block thì sử dụng mã này để thay thế
Mã:
<div class="section">
<div class="secondaryContent">
<h3>Random Quote</h3>
<div class="bqstart">&#8220;</div>
<div class="quotes bq" style="padding-top: 10px; padding-right: 5px;"></div>
<div class="bqend">&#8221;</div>
</div>
</div>

Bước 5: Chỉnh sửa forum_list và thêm <xen:include template="random_quote" /> vào trước </xen:sidebar> hoặc bất cứ nơi nào bạn muốn.

Thêm trích dẫn mới:
Nếu bạn muốn thêm trích dẫn mới, chỉnh sửa tập tin /data/RandomQuote/quotes.txt
Thêm mỗi quote mới trên một dòng riêng biệt như sau:

It's a recession when your neighbor loses his job; it's a depression when you lose yours. - Harry S Truman@
Any man who afflicts the human race with ideas must be prepared to see them misunderstood. - H. L. Mencken@
You must lose a fly to catch a trout. - George Herbert


Tất cả các mục phải được chấm dứt với một @ trừ mục cuối cùng.

Kết quả:

quote.PNG
quote2.PNG

Chúc các bạn thành công.


Nguồn: xenforo.com​
 

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