Bạn ghé thăm diễn đàn lần đầu? hãy đăng ký ngay bây giờ để tham gia.
  • Đăng nhập:

Chào mừng bạn đến với ITVNN FORUM - Diễn đàn công nghệ thông tin.

Nếu đây là lần đầu tiên bạn tham gia diễn đàn, xin mời bạn xem phần Hỏi/Ðáp để biết cách dùng diễn đàn. Để có thể tham gia thảo luận bạn phải đăng ký làm thành viên, click vào đây để đăng ký.


  • Partner Area
    • ITVNN HOSTING - Thiết kế website, Cung cấp Domain, Hosting, VPS Việt Nam Anh Hùng - Thông tin truyền thông
kết quả từ 1 tới 1 trên 1
Tăng kích thước phông chữ Giảm kích thước phông chữ
  1. #1
    s0ct0j0c's Avatar
    Banned

    Trạng thái
    Offline
    Họ tên
    Kiều Sơn Lâm
    Tham gia ngày
    Jan 2011
    Thành viên thứ
    36613
    Đến từ
    TP.HCM
    Tuổi
    31
    Giới tính
    Bài gởi
    454
    Level: 41 [?]
    Experience: 2,207,624
    Next Level: 2,530,022
    Cảm ơn 91
    Cảm ơn 89 lần / 68 Bài viết

    Default Add an RSS feed block to the sidebar  

    This guide will explain how to add an RSS feed block to the sidebar as shown below.



    The code is fully customisable but this mod consists of 3 stacked feeds in a single block (left image) or a single feed (right image).
    The snippet at the top will cycle through each feed in turn and the relevant feed will be underlined when selected. The snippet will also pause on hover (configurable).
    Each headline can be hovered over to see the snippet or clicked on to load the URL.
    The block titles in the stacked version can also be clicked on to load the full RSS feed.

    Change the options and feed titles and URLs in cta_rss_feed_sidebar as required.
    You may also need to tweak cta_rss_feed.css to suit your site but it does use the @styleProperties system so should hopefully work on most basic installations.

    You can create additional templates for use elsewhere either using the same css stylesheet or by creating a new one.
    You can also incorporate all of the above templates into one if you prefer to do it that way.
    I have taken this approach with 3 separate template so I can re-use the cta_rss_feed.css and cta_rss_feed templates elsewhere.

    There are some links at the end of the thread where you can find further information on how to customise it for your own needs.

    I have also attached the templates I am using which you are free to use and modify.


    Create a Google API Key
    Log in to your Google account
    Browse to this URL to sign up for an API key: http://code.google.com/apis/ajaxfeeds/signup.html
    Enter your domain URL: http://www.mydomain.com/
    Note down the API Key


    Create the templates
    Create the css template: cta_rss_feed.css
    Create the master feed template: cta_rss_feed
    Create the sidebar feed template: cta_rss_feed_sidebar


    Populate the templates
    Add this to cta_rss_feed.css
    Note: If you want the snippet titles to use 2 rows then use the alternative css file attached; cta_rss_feed_2_rows.css.txt
    Code: 
    .gfg-root { width: 228px; height: auto; position: relative; overflow: hidden; font-family: 'Trebuchet MS',Helvetica,Arial,sans-serif; }  .gfg-title { font-size: 12pt; color: @primaryLight; padding-bottom: 2px; margin-bottom: 5px; border-bottom: 1px solid @primaryLighterStill; overflow: hidden; white-space: nowrap; }  .gfg-title a { color: @primaryLight; }  .gfg-subtitle { font-size: 12px; font-weight: bold; color: @contentText; background-color: @primaryLighterStill; line-height: 1.4em; overflow: hidden; white-space: nowrap; margin-top: 6px; padding: 0 4px; }  .gfg-subtitle a { color: @contentText; }  .gfg-entry { background-color: @contentBackground; width: 100%; height: 6.9em; position: relative; overflow: hidden; text-align: left; }  .gfg-root .gfg-entry .gf-result { position: relative; background-color: @contentBackground; width: auto; height: 100%; padding: 2px 4px; }  .gfg-list { background-color: @contentBackground; padding: 0 4px; position: relative; overflow: hidden; }  .gfg-listentry { line-height: 1.5em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; }  .gfg-listentry-odd { background-color: @contentBackground; }  .gfg-listentry-even { background-color: @contentBackground; }  .gfg-listentry-highlight { text-decoration: underline; overflow: hidden; }  .gfg-root .gfg-entry .gf-result .gf-title { font-size: 14px; line-height: 1.2em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; }  .gfg-root .gfg-entry .gf-result .gf-snippet { height: 3.8em; color: @contentText; overflow: hidden; }  .gf-result .gf-author, .gf-result .gf-spacer, .gf-result .gf-relativePublishedDate { color: @dimmedTextColor !important; display: inline; }
    Add this to cta_rss_feed - ensure you replace your_API_key with the API key obtained earlier

    Code: 
    <xen:require css="cta_rss_feed.css" />  <script type="text/javascript" src="http://www.google.com/jsapi/?key=your_API_key"></script> <script type="text/javascript" src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js"></script>
    Add this to cta_rss_feed_sidebar

    Code:
    Code: 
    <xen:include template="cta_rss_feed" />  <script type="text/javascript">     var options = {         title : 'News', /* Title of the feed block */         numResults : 6, /* Number of news items for each feed; default is 4 */         displayTime : 3000, /* Time in milliseconds each item is displayed; default is 5000 */         fadeOutTime : 750, /* Time in milliseconds for the current item fade out; default is 1000, 0 to suppress */         scrollOnFadeOut : true, /* Enable or disable scroll on fade out for the current item */         stacked : true /* Required for multiple feeds */     };      function loadRssFeed() {      var feeds = [         {         title: 'BBC News', /* Title of the feed */         url: 'http://feeds.bbci.co.uk/news/rss.xml' /** URL of the feed */         },         {         title: 'Autosport', /* Title of the feed */         url: 'http://www.autosport.com/rss/allnews.xml' /** URL of the feed */         },         {         title: 'XenForo Announcements', /* Title of the feed */         url: 'http://xenforo.com/community/forums/announcements/index.rss' /* URL of the feed */         }         ];      var fg = new GFdynamicFeedControl(feeds, 'rss_feed', options);     document.getElementById('rss_feed');     }      google.load('feeds', '1');     google.setOnLoadCallback(loadRssFeed); </script>  <div class="section">     <div class="secondaryContent" id="rss_feed">Fetching feeds...</div> </div>
    If you want to have just a single feed then use this code instead

    Code: 
    <xen:include template="cta_rss_feed" />  <script type="text/javascript">     var options = {         title : 'Announcements', /* Title of the feed block */         numResults : 6, /* Number of news items for each feed; default is 4 */         displayTime : 3000, /* Time in milliseconds each item is displayed; default is 5000 */         fadeOutTime : 750, /* Time in milliseconds for the current item fade out; default is 1000, 0 to suppress */         scrollOnFadeOut : true, /* Enable or disable scroll on fade out for the current item */     };      function loadRssFeed() {      var feed = 'http://xenforo.com/community/forums/announcements/index.rss'; /* URL of the feed */      var fg = new GFdynamicFeedControl(feed, 'rss_feed', options);     }      google.load('feeds', '1');     google.setOnLoadCallback(loadRssFeed); </script>  <div class="section">     <div class="secondaryContent" id="rss_feed">Fetching feeds...</div> </div>
    Add to the sidebar
    Open the PAGE_CONTAINER template
    Find this:
    Code: 
       	 	                <!-- sidebar -->                 <aside>                     <div class="sidebar">                         <xen:if is="!{$noVisitorPanel}"><xen:include template="sidebar_visitor_panel" /></xen:if>                         {xen:raw $sidebar}                     </div>                 </aside>
    Replace with this:
    Code: 
       	 	                <!-- sidebar -->                 <aside>                     <div class="sidebar">                         <xen:if is="!{$noVisitorPanel}"><xen:include template="sidebar_visitor_panel" /></xen:if>                         {xen:raw $sidebar}                         <xen:include template="cta_rss_feed_sidebar" />                     </div>                 </aside>
    The following links may be of use when creating your own feeds

    Pre-defined Code
    For pre-defined code browse to
    http://code.google.com/apis/ajax/playground/#load_feed

    Select vertical and edit the code to suit
    http://code.google.com/apis/ajax/pla...rol_-_vertical

    Select horizontal and edit the code to suit
    http://code.google.com/apis/ajax/pla...l_-_horizontal

    Custom Code
    To create custom code browse to
    http://www.google.com/uds/solutions/...reference.html

    source thread : http://xenforo.com/community/threads...-sidebar.9381/


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vbb 4.1.5 loi khi code sidebar and block
    By dragon80 in forum Hỏi đáp & Thảo luận
    Trả lời: 0
    Bài mới gởi: 03-12-2011, 01:59 PM
  2. Hỏi về Forum Sidebar and Block Options
    By chi pheo return in forum Hỏi đáp & Thảo luận
    Trả lời: 0
    Bài mới gởi: 27-11-2011, 10:50 AM
  3. Paypal Donation Sidebar Block
    By PhucSD in forum v4.x Modifications
    Trả lời: 0
    Bài mới gởi: 07-06-2011, 11:59 AM
  4. Lỗi Forum sidebar and block options
    By shinichi7211 in forum Hỏi đáp & Thảo luận
    Trả lời: 5
    Bài mới gởi: 19-05-2011, 03:16 PM
  5. Add custom sidebar block
    By s0ct0j0c in forum Add-ons and Modifications
    Trả lời: 0
    Bài mới gởi: 21-04-2011, 07:45 PM

Tags for this Thread

Bookmarks

Quuyền Hạn Của Bạn

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể chỉnh sửa bài viết
  •