$row['content'], 'author' => $row['author']));
unset($row);
/* ----------------------------
-- BÀI VIẾT MỚI --
-----------------------------*/
// PHÂN TRANG
$query = "SELECT * FROM mi_posts WHERE (type=1 AND post=0 AND status=1)";
$p_per_page = CONFIG('PER_PAGE_POST_NEW');
$p_maxpost = NUM($query); $p_maxpage = ceil($p_maxpost/$p_per_page);
$p_page = $_GET['page']; settype($p_page,'int');
if($p_page<=0){$p_page=1;}elseif($p_page>$p_maxpage){$p_page=$p_maxpage;};
$start = ($p_page-1)*$p_per_page;
$result = GETS($query." ORDER BY time DESC LIMIT {$start},{$p_per_page}");
foreach($result as $row){
$comment = NUM("SELECT * FROM mi_comments WHERE post={$row['id']}");
$category = GET("SELECT * FROM mi_categorys WHERE id={$row['category']}");
$array = array(
'title' => $row['title'],
'id' => $row['id'],
'link' => URL.'/post.php?id='.$row['id'],
'description' => ($row['description'] ? DESC($row['description']) : DESC($row['content'])),
'thumbnail' => $row['thumbnail'],
'comment' => $comment,
'category_title' => $category['title'],
'category_link' => URL.'/category.php?id='.$row['category'],
);
$list_post_top_new .= TEMPLATE('post-content',$array);
}
if(!$list_post_top_new) $list_post_top_new = TEMPLATE('post-content-none',NULL);
unset($result, $row, $comment, $category,$query);
/* -----------------------------
- LOAD BÀI VIẾT NHIỀU COMMENT -
------------------------------*/
LOAD('list_post_top_comment');
/* -----------------------------
- LOAD BÀI VIẾT NHIỀU LƯỢT XEM -
------------------------------*/
LOAD('list_post_top_view');
/* ------------------------------
- LOAD DANH SÁCH CHUYÊN MỤC MẸ -
-------------------------------*/
LOAD('list_category_mother');
/* ----------------------------
-- HIỂN THỊ RA MÀN HÌNH --
-----------------------------*/
$MD['title'] = CONFIG('HOME_TITLE');
$MD['meta'] = '
';
LOAD('head');
$array = array(
'p_page' => $p_page,
'p_maxpost' => $p_maxpost,
'pagination_list_post_new' => pagination($p_page,$p_maxpage,'?page='),
'slogan' => $slogan,
'list_post_top_new' => $list_post_top_new,
'list_post_top_comment' => $MD['list_post_top_comment'],
'list_post_top_view' => $MD['list_post_top_view'],
'list_category_mother' => $MD['list_category_mother']
);
ECHO TEMPLATE('index',$array);
LOAD('foot');