hien thi bai viet theo nhãn ra trang chu blogspot dang tin tuc
Cập nhật:
26 thg 8, 2017
tháng 8 26, 2017
1. Code bài viết theo nhãn dạng tin tức blogspot 1
code css
/*post list*/code chèn trên thẻ </body>
.post-list1 {
margin:0px;
width:320px;
float:left;
}
.post-list1 img{
padding:2px;
width: 320px;
height: 200px;
}
.post-list2{
padding-left:15px;
width:220px;
border-bottom: 1px solid #CCCCCC;
float:left;
display: inline-block;
position:relative;
overflow:hidden;
}
.post-list2 img{
padding:2px;
width: 90px;
height: 70px;
margin:5px 0 5px 0;
}
.thumbnail img {
width:90px;
float:left;
}
.post-title3 {
float:right;
width:110px;
}
<script type='text/javascript'>code chèn nơi muốn hiển thị
//<![CDATA[
numposts = 9; list1 = 1; sumPosts = 200;
function removeHtmlTag(a, b) { var s = a.split("<"); for (var i = 0; i < s.length; i++) { if (s[i].indexOf(">") != -1) { s[i] = s[i].substring(s[i].indexOf(">") + 1, s[i].length) } } s = s.join(""); s = s.substring(0, b - 1); return s } function showrecentposts(e) { img = new Array(); img[0] = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJ0vPMhUuANgpqJJIN7iEIfkRrTR1V0cGM6-Nb3YWh9DBvkQkGxix2cCP3lkXJ_HAWurKH6ZMMeGDvcYCEWXy3tyHeGmBoDkQU5psCdHO2yI67enbnD7VPY_Nv4yicUbNBp6RxpodCDue/s1600/no-image.PNG"; for (var i = 0; i < numposts; i++) { var f = e.feed.entry[i]; var g = f.title.$t; var h; if (i == e.feed.entry.length) break; for (var k = 0; k < f.link.length; k++) { if (f.link[k].rel == 'alternate') { h = f.link[k].href; break } } if ("content" in f) { var j = f.content.$t } else if ("summary" in f) { var j = f.summary.$t } else var j = ""; s = j; a = s.indexOf("<img"); b = s.indexOf("src=\"", a); c = s.indexOf("\"", b + 5); d = s.substr(b + 5, c - b - 5); if ((a != -1) && (b != -1) && (c != -1) && (d != "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJ0vPMhUuANgpqJJIN7iEIfkRrTR1V0cGM6-Nb3YWh9DBvkQkGxix2cCP3lkXJ_HAWurKH6ZMMeGDvcYCEWXy3tyHeGmBoDkQU5psCdHO2yI67enbnD7VPY_Nv4yicUbNBp6RxpodCDue/s1600/no-image.PNG")) img[i] = d; var l = '<div class="post-list1"><a href="' + h + '"><img src="' + img[i] + '" title="' + g + '" alt="' + g + '"></a><div class="post-title"><a href="' + h + '" title="' + g + '" alt="' + g + '">' + g + '</a></div><p>' + removeHtmlTag(j, sumPosts) + ' ...</p></div>'; var m = '<div class="post-list2"><a class="thumbnail" href="' + h + '"><img src="' + img[i] + '" title="' + g + '" alt="' + g + '"></a><div class="post-title3"><a href="' + h + '" title="' + g + '" alt="' + g + '">' + g + '</a></div></div>'; if ((i >= 0) && (i < list1)) { var n = l } if (i == list1) { var n = '' + m } if ((i > list1) && (i < numposts - 1)) { var n = m } if (i == numposts - 1) { var n = m + '' } document.write(n) } }
//]]></script>
<h2 class='title'>Bài viết theo nhãn</h2>
<script type='text/javascript'>
//<![CDATA[
document.write("<script src=\"/feeds/posts/default/-/ten-nhan?max-results="+numposts+"&orderby=published&alt=json-in-script&callback=showrecentposts\"><\/script>");
//]]>
</script>
2. bài viết theo nhãn dạng tin tức blogspot 2
code css:
<style type='text/css'>code chèn trên thẻ </body>
/*post list*/
.post-list1 {
margin:0px;
width:53%;
float:left;
}
.post-list1 img{
width: 160px;
height: 120px;
border: none;
display: block;
margin: 0;
padding: 0;
}
.post-list1 .post-title {
font-size: 14px;
padding-bottom: 5px;
}
.thumbaix {
display: block;
float: left;
margin: 5px 10px 0 0;
}
.textpost {
display: block!important;
margin: 0;
padding: 0!important;
text-align: justify;
color: #666;
line-height: 1.7;
}
li.post-list2 {
width: 45%;
float: right;
margin-left: 5px;
border-bottom: 1px dotted #dedede;
margin: 0;
padding: 5px 0 5px 0px;
text-align: justify;
}
</style>
<!-- bai viet theo nhan dang tin tuc -->code chèn nơi muốn hiển thị
<script type='text/javascript'>
//<![CDATA[
numposts = 5; list1 = 1; sumPosts = 170;
function removeHtmlTag(a, b) { var s = a.split("<"); for (var i = 0; i < s.length; i++) { if (s[i].indexOf(">") != -1) { s[i] = s[i].substring(s[i].indexOf(">") + 1, s[i].length) } } s = s.join(""); s = s.substring(0, b - 1); return s } function showrecentposts(e) { img = new Array(); img[0] = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJ0vPMhUuANgpqJJIN7iEIfkRrTR1V0cGM6-Nb3YWh9DBvkQkGxix2cCP3lkXJ_HAWurKH6ZMMeGDvcYCEWXy3tyHeGmBoDkQU5psCdHO2yI67enbnD7VPY_Nv4yicUbNBp6RxpodCDue/s1600/no-image.PNG"; for (var i = 0; i < numposts; i++) { var f = e.feed.entry[i]; var g = f.title.$t; var h; if (i == e.feed.entry.length) break; for (var k = 0; k < f.link.length; k++) { if (f.link[k].rel == 'alternate') { h = f.link[k].href; break } } if ("content" in f) { var j = f.content.$t } else if ("summary" in f) { var j = f.summary.$t } else var j = ""; s = j; a = s.indexOf("<img"); b = s.indexOf("src=\"", a); c = s.indexOf("\"", b + 5); d = s.substr(b + 5, c - b - 5); if ((a != -1) && (b != -1) && (c != -1) && (d != "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggJ0vPMhUuANgpqJJIN7iEIfkRrTR1V0cGM6-Nb3YWh9DBvkQkGxix2cCP3lkXJ_HAWurKH6ZMMeGDvcYCEWXy3tyHeGmBoDkQU5psCdHO2yI67enbnD7VPY_Nv4yicUbNBp6RxpodCDue/s1600/no-image.PNG")) img[i] = d; var l = '<div class="post-list1"><h2 class="post-title"><a href="' + h + '" title="' + g + '" alt="' + g + '">' + g + '</a></h2><a class="thumbaix" href="' + h + '"><img src="' + img[i] + '" title="' + g + '" alt="' + g + '"></a><p class="textpost">' + removeHtmlTag(j, sumPosts) + ' ...</p></div>'; var m = '<li class="post-list2"><a href="' + h + '" title="' + g + '" alt="' + g + '">' + g + '</a></li>'; if ((i >= 0) && (i < list1)) { var n = l } if (i == list1) { var n = '' + m } if ((i > list1) && (i < numposts - 1)) { var n = m } if (i == numposts - 1) { var n = m + '' } document.write(n) } }
//]]></script>
<h2 class='title'>Bài viết theo nhãn</h2>
<script type='text/javascript'>
//<![CDATA[
document.write("<script src=\"/feeds/posts/default/-/ten-nhan?max-results="+numposts+"&orderby=published&alt=json-in-script&callback=showrecentposts\"><\/script>");
//]]>
</script>