Rows($sql) or die("Not query sql1"); $co_id = $r[0]['co_id']; #------------------------------------------------------ $ds = "SELECT * FROM tbl_option WHERE co_id='$co_id'"; $r8=$db->Rows($ds); #TIN TUC NOI BAT $sql3 = "SELECT * FROM tbl_news_com WHERE co_id = '$co_id' ORDER BY iOrder, hotnews, post_date DESC LIMIT 0,1"; $r3 = $db->Rows($sql3); $new_id = $r3[0]['news_id']; $sql4 = "SELECT * FROM tbl_news_com WHERE co_id = '$co_id' AND news_id<'$new_id' ORDER BY news_id, iOrder, hotnews, post_date DESC LIMIT 0,3"; $r4 = $db->Rows($sql4); #--------Menu------------------------------------------------------------ $menu="select san_phamtb,san_pham,loi_chao,backgrounb,img_foot,img_bg,bg_top from tbl_menubg where co_id='$co_id'"; $row_menu=$db->Rows($menu); /*#-------------------------------------------------------------------------- $new="select * from tbl_news order by ne_id desc limit 0,1"; $row_new=$db->Rows($new); #--New --------------------------------------------------------------------- $new_cu="select * from tbl_news order by ne_id desc limit 1,3"; $row_cu=$db->Rows($new_cu); #-------------------------------------------------------------------------- $new_docnhieu="select * from tbl_news order by ne_id desc limit 4,8"; $row_doc=$db->Rows($new_docnhieu); #-------------------------------------------------------------------------- #NEWS GROUP $sql1 = "SELECT * FROM tbl_news_group WHERE at_id <> 2 ORDER BY gn_order DESC LIMIT 0,6"; $rs1 = mysql_query($sql1) or die("Not query sql1"); $r1 = array(); $r2 = array(); while($rows1 = mysql_fetch_array($rs1)) { $r1[] = $rows1; #NEWS $sql2 = " SELECT A1.*, A2.gn_name FROM tbl_news as A1 left join tbl_news_group as A2 on A1.gn_id = A2.gn_id WHERE A1.gn_id = ".$rows1['gn_id']." AND A1.at_id <> 2 ORDER BY date_edited DESC LIMIT 0,1"; $rs2 = mysql_query($sql2) or die("Not query sql2"); while($rows2 = mysql_fetch_array($rs2)) { $r2[] = $rows2; } } */ #-------------------------------------------------------------------------- $sqltemp = "Select * From tbl_template a,tbl_company b where a.id_template = b.id_template AND co_id = $co_id"; $rtemp = $db->Rows($sqltemp); #------------------------------------------------------------------------- $intro="select t.*,c.co_id,c.account from tbl_intro t,tbl_company c where t.co_id=c.co_id and c.co_id='$co_id'"; $r_intro=$db->Rows($intro); #------------------------------------------------------------------------- $pro_home="select * from tbl_product where co_id='$co_id' order by pro_id desc "; $r_home=$db->Rows($pro_home); #------------------------------------------------------------------------- $new_home="select * from tbl_news_com where co_id='$co_id' order by news_id desc limit 5,1 "; $r_news=$db->Rows($new_home); #-------------------------------------------------------------------------- $sql_loichaothem = "SELECT * FROM tbl_banner_them WHERE co_id = '$co_id'"; $r_loichaothem = $db->Rows($sql_loichaothem); #------------------------------------------------------------------------- $sql_op = "SELECT tintuc_index,mot_line FROM tbl_option WHERE co_id = '$co_id'"; $r_op = $db->Rows($sql_op) or die("Not query sql_op"); #------------------------------------------------------------------------- $smarty->assign("r",$r); $smarty->assign("r_op",$r_op); $smarty->assign("r8",$r8); $smarty->assign("company",$company); $smarty->assign("r3",$r3); $smarty->assign("r4",$r4); #-------------------------------------------------------------------------- $smarty->assign("row_menu",$row_menu); $smarty->assign("row_new",$row_new); $smarty->assign("row_cu",$row_cu); $smarty->assign("row_doc",$row_doc); $smarty->assign('r2',$r2); $smarty->assign('r_intro',$r_intro); $smarty->assign('r_home',$r_home); $smarty->assign('r_news',$r_news); $smarty->assign("r_loichaothem",$r_loichaothem); #-------------------------------------------------------------------------- $smarty->assign("rtemp",$rtemp); $smarty->display($template_root.$rtemp[0]["url_template"].'/home.tpl'); ?>