Tuesday, May 15, 2012

Cách chèn RSS Feed vào page blogger

* Sử dụng Google API để đưa RSS vào page

ví dụ: muốn đưa nội dung từ RSS http://www.itgate.com.vn/rss/index.aspx?nws/55 vào page

Insert đoạn code HTLM sau vào HTML của page

<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google AJAX Search API Sample</title>
    <script src="http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0" type="text/javascript"></script>
    <script type="text/javascript">
    /*
    *  How to use the Feed Control to grab, parse and display feeds.
    */
    
    google.load("feeds", "1");
    
    function OnLoad() {
      // Create a feed control
      var feedControl = new google.feeds.FeedControl();
    
      // Add two feeds.
      feedControl.addFeed("http://www.itgate.com.vn/rss/index.aspx?nws/55", "Kiến thức!");
     
    
      // Draw it.
      feedControl.draw(document.getElementById("content"));
    }
    
    google.setOnLoadCallback(OnLoad);
    </script>
  </head>
  <body style="font-family: Arial;border: 0 none;">


<br/>
<br/>
<br/>

    <div id="content">Loading...</div>
  </body>
</html>

1 comment:

  1. Bạn có thể cho mình code chuẩn được không. Mình muốn chèn Feed cho website tktech.vn vào blogger để nó cập nhật tất cả các bài viết của mình lên đó.

    ReplyDelete