function addPostScrollAction() { $postDB = $this->getPostData(); $take = $postDB['NoP']; $data['posts'] = Post::getPost_skip_take($postDB['cateID'], $postDB['qty_now'], $take + 1); //$data['posts'] = Post::getPost_skip_take($cateID, $qty_now, $take + 1); $html = ""; foreach ($data['posts'] as $key => $p) { if ($key < $take) { $p['link'] = strtolower($this->convertUnicode($p['title'])); ob_start(); ?> <div class="item_post post_<?php echo $p['id']; ?> "> <div class="all-post"> <div class="item_image"> <div class="image-box"> <a href="../bai-viet/<?php echo $p['link'] . '/' . $p['id']; ?> "> <img src="<?php echo $this->IMG_POST_DIR . $p['image']; ?> " alt="<?php echo $p['title']; ?> " /> </a> </div> </div> <div class="right-info"> <div class="info-box"> <div class="item_title"> <a href="../bai-viet/<?php echo $p['link'] . '/' . $p['id']; ?> "><?php echo $p['title']; ?> </a> </div> <div class="item_time"> <span><?php echo date("H:i d-m-Y", strtotime($p['time'])); ?> </span> </div> <div class="item_summary"> <span><?php echo $p['summary']; ?> </span> </div> <div class="item_read_more" title="Chọn để xem nội dung chi tiết"> <a href="../bai-viet/<?php echo $p['link'] . '/' . $p['id']; ?> ">Xem thêm...</a> </div> </div> </div> </div> </div> <?php $html = $html . ob_get_clean(); } } $tbc = isset($data['posts'][$take]); echo json_encode(array("html" => $html, "tbc" => $tbc)); exit; }