if ($st_links > 0) { $db_slave->sqlreset()->select('id, listcatid, addtime, edittime, publtime, title, alias, hitstotal')->from(NV_PREFIXLANG . '_' . $module_data . '_' . $catid)->order($order_by)->limit($st_links); if ($viewcat == 'viewcat_page_new') { $db_slave->where('status=1 AND publtime < ' . $end_publtime); } else { $db_slave->where('status=1 AND publtime > ' . $end_publtime); } $result = $db_slave->query($db_slave->sql()); while ($item = $result->fetch()) { $item['newday'] = $global_array_cat[$catid]['newday']; $item['link'] = $global_array_cat[$catid]['link'] . '/' . $item['alias'] . '-' . $item['id'] . $global_config['rewrite_exturl']; $array_cat_other[] = $item; } } $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page); $contents = viewcat_page_new($array_catpage, $array_cat_other, $generate_page); } elseif ($viewcat == 'viewcat_main_left' or $viewcat == 'viewcat_main_right' or $viewcat == 'viewcat_main_bottom') { $array_catcontent = array(); $array_subcatpage = array(); $db_slave->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $module_data . '_' . $catid)->where('status=1'); $num_items = $db_slave->query($db_slave->sql())->fetchColumn(); $db_slave->select('id, listcatid, topicid, admin_id, author, sourceid, addtime, edittime, publtime, title, alias, hometext, homeimgfile, homeimgalt, homeimgthumb, allowed_rating, hitstotal, hitscm, total_rating, click_rating'); $featured = 0; if ($global_array_cat[$catid]['featured'] != 0) { $db_slave->where('status=1 AND id=' . $global_array_cat[$catid]['featured']); $result = $db_slave->query($db_slave->sql()); if ($item = $result->fetch()) { if ($item['homeimgthumb'] == 1) { //image thumb $item['imghome'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $item['homeimgfile']; } elseif ($item['homeimgthumb'] == 2) {
$item['imgthumb'] = $array_img[1]; $item['link'] = $global_array_cat[$catid]['link'] . "/" . $item['alias'] . "-" . $item['id']; $array_catpage[] = $item; $end_publtime = $item['publtime']; } if ($viewcat == "viewcat_page_new") { $sql = "SELECT `id`, `listcatid`, `addtime`, `edittime`, `publtime`, `title`, `alias`, `hitstotal` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE `status`=1 AND `publtime` < " . $end_publtime . " AND `publtime` < " . NV_CURRENTTIME . " AND (`exptime`=0 OR `exptime`>" . NV_CURRENTTIME . ") " . $order_by . " LIMIT 0," . $st_links . ""; } else { $sql = "SELECT `id`, `listcatid`, `addtime`, `edittime`, `publtime`, `title`, `alias`, `hitstotal` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE `status`=1 AND `publtime` > " . $end_publtime . " AND `publtime` < " . NV_CURRENTTIME . " AND (`exptime`=0 OR `exptime`>" . NV_CURRENTTIME . ") " . $order_by . " LIMIT 0," . $st_links . ""; } $result = $db->sql_query($sql); while ($item = $db->sql_fetchrow($result)) { $item['link'] = $global_array_cat[$catid]['link'] . "/" . $item['alias'] . "-" . $item['id']; $array_cat_other[] = $item; } $contents = viewcat_page_new($array_catpage, $array_cat_other); $contents .= nv_news_page($base_url, $all_page, $per_page, $page); } elseif ($viewcat == "viewcat_main_left" or $viewcat == "viewcat_main_right" or $viewcat == "viewcat_main_bottom") { $array_catcontent = array(); $array_subcatpage = array(); //$sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `listcatid`, `topicid`, `admin_id`, `author`, `sourceid`, `addtime`, `edittime`, `publtime`, `title`, `alias`, `hometext`, `homeimgfile`, `homeimgalt`, `homeimgthumb`, `imgposition`, `inhome`, `allowed_rating`, `ratingdetail`, `hitstotal`, `hitscm` , `keywords` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE `status`=1 AND `publtime` < " . NV_CURRENTTIME . " AND (`exptime`=0 OR `exptime`>" . NV_CURRENTTIME . ") ORDER BY `id` DESC LIMIT " . $page . "," . $per_page . ""; // get list children categoires $_sql_list_children = "SELECT `catid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `parentid` = " . $catid; $_array_catid = array(); $_results = $db->sql_query($_sql_list_children); while ($item = $db->sql_fetchrow($_results)) { $_array_catid[] = $item['catid']; } unset($_results); $_sql_get_posts = ""; $test = 0;