Demo
Cách làm :
Đây là code hiển thị : ( chèn ở chỗ nào tùy bạn , nhưng nên chèn ở cột bên phải cho đẹp )
Vừa xin admin code này cho luôn nên đem share cho mọi người dùng
Auto cập nhật bài viết + hình ảnh thông qua từng box
Cách làm :
Đây là code hiển thị : ( chèn ở chỗ nào tùy bạn , nhưng nên chèn ở cột bên phải cho đẹp )
- Code:
<!--BEGIN LAST-->
<div style="height: 115px;display:block">
<span class="show_topich">
</span>
<script>
$(function () {
$.ajax({url: "/feed/?f=29",
success: function (ta) {
for(var i=2;i<7;i++)
{
var DL=$(ta).find("link:eq("+i+")").text();
$('<a href="'+DL+'" class="ava_new"></a>').appendTo('.show_topich:eq('+(i-2)+')');
$('<img src="'+$(".show_topich:eq("+(i-2)+") a").load(DL+".postbody .post-entry img:eq(0)")+'"/>').appendTo('.show_topich:eq('+(i-2)+') a');
$('<strong><a href="'+DL+'">'+$(ta).find("title:eq("+i+")").text()+'</a></strong>').appendTo('.show_topich:eq('+(i-2)+')');
}
}})
})
</script>
</style><style>
}
.show_topich {
display: inline-block;
height: 190px;
}
</style>
<br> <br> <br>
<span class="show_topic2">
</span>
<script>
$(function () {
$.ajax({url: "/feed/?f=52",
success: function (ta) {
for(var i=2;i<7;i++)
{
var DL=$(ta).find("link:eq("+i+")").text();
$('<a href="'+DL+'" class="ava_new"></a>').appendTo('.show_topic2:eq('+(i-2)+')');
$('<img src="'+$(".show_topic2:eq("+(i-2)+") a").load(DL+".postbody .post-entry img:eq(0)")+'"/>').appendTo('.show_topic2:eq('+(i-2)+') a');
$('<strong><a href="'+DL+'">'+$(ta).find("title:eq("+i+")").text()+'</a></strong>').appendTo('.show_topic2:eq('+(i-2)+')');
}
}})
})
</script>
<style>
}
a.ava_new,span.ava_new img {
width: 239px;
height: 150px;
display: inline-block;
border: 1px solid #b0b0b0;
overflow: hidden;
margin-left: 0px;
}
.show_topic2 {
display: inline-block;
height: 190px;
}
a.ava_new img, span.ava_new img {
-webkit-border-radius: 3px;
border: 1px solid #DDD;
border-radius: 3px;
float: left;
height: 50px!important;
margin: 0 5px;
max-height: 200px;
max-width: 200px;
padding: 1px;
width: 50px!important;
}
</style>
</div>
<!--END LAST-->
<!--BEGIN LAST-->
<div style="height: 115px;display:block">
<span class="show_topich7">
</span>
<script>
$(function () {
$.ajax({url: "/feed/?f=2",
success: function (ta) {
for(var i=2;i<7;i++)
{
var DL=$(ta).find("link:eq("+i+")").text();
$('<a href="'+DL+'" class="ava_new"></a>').appendTo('.show_topich7:eq('+(i-2)+')');
$('<img src="'+$(".show_topich7:eq("+(i-2)+") a").load(DL+".postbody .post-entry img:eq(0)")+'"/>').appendTo('.show_topich7:eq('+(i-2)+') a');
$('<strong><a href="'+DL+'">'+$(ta).find("title:eq("+i+")").text()+'</a></strong>').appendTo('.show_topich7:eq('+(i-2)+')');
}
}})
})
</script>
</style><style>
}
.show_topich7 {
display: inline-block;
height: 190px;
}
</style>
<br> <br>
<span class="show_topic4">
</span>
<script>
$(function () {
$.ajax({url: "/feed/?f=100",
success: function (ta) {
for(var i=2;i<7;i++)
{
var DL=$(ta).find("link:eq("+i+")").text();
$('<a href="'+DL+'" class="ava_new"></a>').appendTo('.show_topic4:eq('+(i-2)+')');
$('<img src="'+$(".show_topic4:eq("+(i-2)+") a").load(DL+".postbody .post-entry img:eq(0)")+'"/>').appendTo('.show_topic4:eq('+(i-2)+') a');
$('<strong><a href="'+DL+'">'+$(ta).find("title:eq("+i+")").text()+'</a></strong>').appendTo('.show_topic4:eq('+(i-2)+')');
}
}})
})
</script>
<style>
}
a.ava_new,span.ava_new img {
width: 239px;
height: 150px;
display: inline-block;
border: 1px solid #b0b0b0;
overflow: hidden;
margin-left: 0px;
}
.show_topic4 {
display: inline-block;
height: 190px;
}
a.ava_new img, span.ava_new img {
-webkit-border-radius: 3px;
border: 1px solid #DDD;
border-radius: 3px;
float: left;
height: 50px!important;
margin: 0 5px;
max-height: 200px;
max-width: 200px;
padding: 1px;
width: 50px!important;
}
</style>
</div>
<!--END LAST-->
<!--BEGIN LAST9-->
<div style="height: 55px;display:block">
<span class="show_topic9">
</span>
<script>
$(function () {
$.ajax({url: "/feed/?f=11",
success: function (ta) {
for(var i=2;i<7;i++)
{
var DL=$(ta).find("link:eq("+i+")").text();
$('<a href="'+DL+'" class="ava_new1"></a>').appendTo('.show_topic9:eq('+(i-2)+')');
$('<img src="'+$(".show_topic9:eq("+(i-2)+") a").load(DL+".postbody .post-entry img:eq(0)")+'"/>').appendTo('.show_topic9:eq('+(i-2)+') a');
$('<strong><a href="'+DL+'">'+$(ta).find("title:eq("+i+")").text()+'</a></strong>').appendTo('.show_topic9:eq('+(i-2)+')');
}
}})
})
</script>
<style>
}
a.ava_new1,span.ava_new1 img {
width: 239px;
height: 180px;
display: inline-block;
border: 1px solid #b0b0b0;
overflow: hidden;
margin-left: 0px;
}
.show_topic9 {
display: inline-block;
height: 190px;
}
a.ava_new img, span.ava_new img {
-webkit-border-radius: 3px;
border: 1px solid #DDD;
border-radius: 3px;
float: left;
height: 50px!important;
margin: 0 5px;
max-height: 200px;
max-width: 200px;
padding: 1px;
width: 50px!important;
}
</style>
<style>
</style></div>
<!--END LAST9-->
<script type="text/javascript">
function chuyenmuclast(n,idchuyenmuc)
{
$(function () {
$.ajax({url: "/feed/?f="+n,
success: function (ta)
{
for(var i=2;i<10;i++)
$('<div class="last">
<li>
<img src="http://i72.servimg.com/u/f72/17/29/57/56/new10.gif" style="margin-right:4px"><a style="float:left;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:346px;" href="'+$(ta).find("link:eq("+i+")").text()+'" title="'+$(ta).find("title:eq("+i+")").text()+'"> '+$(ta).find("title:eq("+i+")").text()+'</a> <a style="float:right"> </a>
</div>
</li>
<br/>
').appendTo(idchuyenmuc);
}
})
})
}
</script>
<style>
.last li
{
list-style:none;
padding-left:10px;
display:block;
}
a.ava_new1 img, span.ava_new1 img {
-webkit-border-radius: 3px;
border: 1px solid #DDD;
border-radius: 3px;
float: left;
height: 50px!important;
margin: 0 5px;
max-height: 200px;
max-width: 200px;
padding: 1px;
width: 50px!important;
}
</style>
Chú ý : trong code có những đoạn :
/feed/?f=29",
/feed/?f=52",
....
f=29 <<< 29 là số box của bạn muốn hiển thị bài viết ở box nào thì thay số box của bạn vào
ok xong