- Tham gia
- 28/02/2015
- Bài viết
- 15,966
- Được Like
- 12,454
Tương tự như bài: Thêm text preview cho bài đăng trong Thread List.
Vào template thread_list_item , tìm </h3> , chèn đoạn code sau vào trước thẻ </h3> đó
Vậy là xong . Trong đoạn Code trên mình có giới hạn 100 ký tự . Tùy theo site bạn mà chỉnh sửa lại nhé
Vào template thread_list_item , tìm </h3> , chèn đoạn code sau vào trước thẻ </h3> đó
Mã:
<div id="discussionItem-{$thread.thread_id}"></div>
<script>
$.ajax({
type:'GET',
url:'{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}'
}).done(function(result){
$('#discussionItem-{$thread.thread_id}').html('<div class=\"discussionFirstItem\">'+$(result)
.find('blockquote').html().substring(0,100)+'...</div>');
});
</script>
Vậy là xong . Trong đoạn Code trên mình có giới hạn 100 ký tự . Tùy theo site bạn mà chỉnh sửa lại nhé
Nguồn: tailieu24h.net