Tuesday, July 27, 2010

Tạo bài liên quan cho Blogger

Điều này rất tiện cho người đọc theo dõi các bài viết trên Blog bạn.Vậy hôm nay chúng ta thử vọc thủ thuật này xem sao nha

Đây là thủ thuật trích từ Mỏ thủ thuật

1. Vào bố cục
2. Vào chỉnh sửa code HTML
3. Chọn mở rộng mẫu tiện ích
4. Chèn đoạn code bên dưới vào trước thẻ đóng </head>


<script src=’http://data.fandung.com/js/rp-posts.js‘ type=’text/javascript’/>

<script type=’text/javascript’>
var maxEntries = 4;
</script>

<style type=’text/css’>
#rp-pre {
float:right;
width:150px;
padding-left:10px;
}

#rp-content {
border:1px solid #bbb;
background:#eee;
}

#rp-title {
text-align: center;
background:#bbb;
font-weight:bold;
color:#F95107;
margin:3px;
padding-bottom:2px;
}

#rp-posts {
position:relative;
left:-20px;
}

#rp-posts a {
background: url(http://farm3.static.flickr.com/2426/3638176588_31366a6822_o.gif) no-repeat left;
padding-left:13px;
}

#rp-posts ul li {
list-style :none;
}
</style>

- Code : var maxEntries = 4; chính là số bài viết mà bạn muốn hiển thị cho 1 nhãn.
- Trong hình minh họa, box hiện thị ở bên phải, nếu bạn muốn nó hiển thị ở bên trái thì sửa code float:right; thành float:left;

5. Tiếp tục di chuyển xuống phía dưới trong code template, tìm đoạn code bên dưới:

<data:post.body/>

6. Thêm đoạn code bên dưới vào trước dòng code vừa tìm được:


<b:if cond=’data:blog.pageType == &quot;item&quot;’>

<div id=’rp-pre’>
<div id=’rp-content’><div id=’rp-title’>Bài liên quan</div>
<div id=’rp-posts’/></div></div>

<b:loop values=’data:post.labels’ var=’label’>
<script expr:src=’&quot;/feeds/posts/summary/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=getRandomPosts&amp;max-results=999&quot;’ type=’text/javascript’/>
</b:loop>

</b:if>


7. Save template.
Down file js nếu lỗi host data fandung
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 nhận xét

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© Sổ ghi chú
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Posts RSSComments RSS
Back to top