実行結果
設置サンプルのソース
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ja" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title>設置サンプル</title>
<link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
<!-- Feed -->
<link rel="alternate" type="application/rss+xml" title="PHP & JavaScript Room" href="http://feeds.feedburner.com/PhpJavascriptRoom" />
<link rel="alternate" type="application/atom+xml" title="My Blogger" href="http://feeds.feedburner.com/CocoismsDailyTweets" />
<link rel="alternate" type="application/rss+xml" title="My Flickr" href="http://api.flickr.com/services/feeds/photos_public.gne?id=22559849@N06&lang=en-us&format=rss_200n" />
<link rel="alternate" type="application/rss+xml" title="My Twitter Feed (RSS)" href="http://twitter.com/statuses/user_timeline/7948862.rss" />
<link rel="alternate" type="application/atom+xml" title="My Twitter Feed (Atom)" href="http://twitter.com/statuses/user_timeline/7948862.atom" />
<!-- JS -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/content/lib/jquery/jquery.jfeed.js"></script>
<script type="text/javascript">
$(function(){
$.getFeed({
url: 'index.xml',
success: function(feed){
$('#myfeed').append('<h2><a href="'+feed.link+'">'+feed.title+'</a></h2>');
var s="";
for(var i=0; i<feed.items.length && i<3; i++){
var item=feed.items[i];
s+='<h3><a href="'+item.link+'">'+item.title+'</a></h3>';
s+='<div class="updated">'+item.updated+'</div>';
s+='<div class="desc">'+item.description+'</div>';
}
$('#myfeed').append(s);
}
});
});
</script>
<!-- CSS -->
<style type="text/css">
body {
background:#fff;
}
#myfeed {
width:500px;
}
#myfeed dl {
margin:0; padding:0;
border-bottom:1px dotted #666;
}
#myfeed dt {
border-top:1px dotted #666;
margin:0; padding:10px 0 0 0;
width:75px;
float:left;
clear:both;
}
#myfeed dd {
border-top:1px dotted #666;
margin:0; padding:5px 0 0 10px;
margin-left:75px;
}
#myfeed p {
margin:0 0 10px 0; padding:0;
}
#myfeed p.title {
margin:0 0 10px 0; padding:0;
font-weight:bold;
}
#myfeed h3 {
font-size:100%;
font-weight:normal;
}
#myfeed h3 a {
text-decoration:none;
}
#myfeed div.desc {
margin:0 0 20px 0;
}
</style>
<link rel="stylesheet" type="text/css" href="/common/css/example.css"></head>
<body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
<div id="wrap">
<h1>設置サンプル</h1>
<p>参考:<a href='http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin'>jFeed: JavaScript jQuery RSS/ATOM feed parser plugin</a></p>
<!-- CODE -->
<div id="myfeed"></div>
<!-- / CODE -->
</div>
</body>
</html>