0) { $ca_id = intval($_REQUEST['ca']); } if(isset($_REQUEST['w']) && trim($_REQUEST['w'])<>"") { $w = trim($_REQUEST['w']); $strULR1.=$w; $WHERE.=" AND da_name like '$w%' "; } if($ca_id>0) $sql = "SELECT * FROM tbl_category WHERE ca_id=".$ca_id; else $sql = " SELECT A2.ca_name ,A2.ca_id, A2.ca_image FROM tbl_category as A2 WHERE A2.ca_parent=0 ORDER BY A2.ca_order ASC "; $result = mysql_query($sql) or die("Not query"); $r = array(); $r1 = array(); $r2 = array(); $r3 = array(); $r4 = array(); //$r5 = array(); $k=-1; while($rows = mysql_fetch_array($result)) { if($ca_id>0) { $i=0; $r[] = $rows; $sql_web = "SELECT * FROM tbl_danhba WHERE ca_id = ".$ca_id.$WHERE; $result_web = mysql_query($sql_web) or die("Not query"); $total_records=@mysql_num_rows($result_web); $record_per_page=50; $scroll=10; $page->set_qry_string($strURL); $page->set_page_data("website_catelogue.php",$total_records,$record_per_page,$scroll,true,true,true); $result_get_web = mysql_query($page->get_limit_query($sql_web)); while($rows_web = mysql_fetch_array($result_get_web)) { $i++; if($i==1) $r1[] = $rows_web; else if($i==2) $r2[] = $rows_web; else if($i==3) $r3[] = $rows_web; else if($i==4) $r4[] = $rows_web; else if($i==5) { $r5[] = $rows_web; $i=0; } } $showPage=$page->get_page_nav(); $total_page=$page->total_page; $fN = $n_page*$record_per_page + 1; $tN = ($n_page+1)*$record_per_page; if($tN > $total_records) $tN=$total_records; } else { $r[] = $rows; $sql_web = "SELECT * FROM tbl_danhba WHERE ca_id = ".$rows['ca_id'].$WHERE." LIMIT 0,25"; $result_web = mysql_query($sql_web) or die("Not query"); if(mysql_num_rows($result_web)) { $i=0; while($rows_web = mysql_fetch_array($result_web)) { if($i==0) $k++; $i++; if($i==1) $r1[$k] = $rows_web; else if($i==2) $r2[$k] = $rows_web; else if($i==3) $r3[$k] = $rows_web; else if($i==4) $r4[$k] = $rows_web; else if($i==5) { $r5[$k] = $rows_web; $i=0; } } } } } #BANNER $sqlBanner = "SELECT * FROM tbl_banner WHERE ba_id = 4"; $rB = $db->Rows($sqlBanner); $smarty->assign('rB',$rB); #GET LIST APHA $rL = list_abc(); #-------------------------------------------------------------------------- #FUNCTION function list_abc(){ $strSQL = "SELECT * FROM tbl_abc "; $result = mysql_query($strSQL); $r = array(); while($rows=mysql_fetch_array($result)) $r[] = $rows; return $r; } #-------------------------------------------------------------------------- $smarty->assign('r',$r); $smarty->assign("showPage",$showPage); $smarty->assign("total_page",$total_page); $smarty->assign("total_records",$total_records); $smarty->assign("fN",$fN); $smarty->assign("tN",$tN); $smarty->assign("ca_id",$ca_id); $smarty->assign("r1",$r1); $smarty->assign("r2",$r2); $smarty->assign("r3",$r3); $smarty->assign("r4",$r4); //$smarty->assign("r5",$r5); $smarty->assign("rL",$rL); $smarty->assign("strULR1",$strULR1); #-------------------------------------------------------------------------- $smarty->display($template_root.'website_catelogue.tpl'); ?>