[blog]
Hướng dẫn các bạn cách viết JSON Feed API Blogger, lấy dữ liệu từ blogger bằng cách đọc nguồn cấp dữ liệu blog bằng JSON và JavaScript nội dung viết bởi giaodienblog.net.
Cách viết:
<script type="text/javascript"> function mycallback(json) { for (var i = 0; i < json.feed.entry.length; i++) { for (var j = 0; j < json.feed.entry[i].link.length; j++) { if (json.feed.entry[i].link[j].rel == 'alternate') { var postUrl = json.feed.entry[i].link[j].href; break; } } var postTitle = json.feed.entry[i].title.$t; var postSummary = json.feed.entry[i].summary.$t; var item = '<div class="wrapper"><h3><a href=' + postUrl + '>' + postTitle + '</h3></a><p>' + postSummary + '</p></div>'; document.write(item); } } </script>
Trong đó:
var postUrl = json.feed.entry[i].link[j].href; code lấy link bài viết
var postTitle = json.feed.entry[i].title.$t; đây là code để lấy tiêu đề bài viết.
var postSummary = json.feed.entry[i].summary.$t; code để lấy một đoạn bài viết đầu tiên
var item = '<div class="wrapper"><h3><a href=' + postUrl + '>' + postTitle + '</h3></a><p>' + postSummary + '</p></div>';
Trong đoạn code trên phần bôi đen chính là phần html sẽ hiển thị trên web, và các thông số như: postUrl , postTitle, postSummary các bạn sẽ gọi từ trên xuống.
Sau khi bạn viết xong thì gọi đoạn script trên để hiển thị như sau:
<script src="http://www.giaodienblog.net/feeds/posts/summary/-/Blogger?max-results=5&alt=json-in-script&callback=mycallback"></script>
Trong đó http://www.giaodienblog.net là domain web của bạn, và Blogger là lấy theo nhãn, bạn thay nhãn của bạn vô đó.
Mục đích của bài viết này là các bạn có thể dùng nó để code bài viết trên blogspot, code các tiện ích cho blog.
Một số code khác:
var postAuthor = json.feed.entry[i].author[0].name.$t; lấy tên bác giả blog
json.feed.id.$t lấy id blog
json.feed.updated.$t Cập nhật lần cuối
json.feed.category[] Danh sách label của blog
json.feed.category[i].term Lấy label thứ i
json.feed.category[0].term Lấy label đầu tiên
json.feed.openSearch$totalResults.$t Tổng số bài viết
json.feed.title.$t Tên blog của bạn
json.feed.entry[i].media$thumbnail.url Lấy link hình ảnh
Và còn nhiều code khác, nếu bạn cần hãy comment bên dưới nhé.
[/blog]
Pick machines based mostly on what you want to extend your enjoyment. Whether you want simpler machines with a single payout line or ones with plenty of bonus features, play those you 바카라사이트 take pleasure in. The odds usually are not going to be significantly better on one kind or the other. Remember that luck performs a major role in your slot success, so while your technique is to win, having fun with the machine you play on is equally necessary. Most machines only pay bonuses and progressive jackpots when the maximum credits are bet. Even on non-progressive machines, the jackpot payout for the maximum credit score bet is usually markedly higher than at another stage.
Trả lờiXóa