Hãy đăng ký thành viên để có thể dễ dàng trao đổi, giao lưu và chia sẻ về kiến thức đồ họa.
  1. Hãy đăng ký subscribe kênh Youtube mới của Việt Designer tại địa chỉ: Youtube.com/VietDesignerChannel để theo dõi các video về thiết kế đồ họa. Do trước đó kênh cũ bị Youtube quét không rõ lý do, trong thời gian chờ kháng cáo nếu các bạn thấy video trên diễn đàn bị die không xem được thì có thể vào kênh mới để tìm xem video sơ cua nhé.
    Loại bỏ thông báo

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

Chủ đề thuộc danh mục 'Hướng dẫn - Thủ thuật Xenforo' được đăng bởi PCO, 14/4/16.

Lượt xem: 4,374

  1. PCO Thành viên cấp 2

    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>
    Code:
    <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
    Code:
    .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:
    Code:
    <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ế
    Code:
    <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ả:

    pRBWk0q.png
    6rkTzXC.png
    Chúc các bạn thành công.

    Nguồn: VNXF.VN

    ...
    Phạm Hữu Dư thích bài viết này

Ủng hộ diễn đàn