sql_query("SELECT * FROM cats ORDER BY position"); $cats = $db->fetched_array(); $smarty->assign("cats",$cats); if(isset($_GET['id'])){ $catIdURI=$_GET['id']; }else{ $catIdURI=$cats[0]['uri']; } $db->sql_query("select id from subcats where uri='".$catIdURI."' order by position"); $catId=$db->fetch_item('id'); $smarty->assign("subcid",$catId); $db->sql_query("select * from subcats where id='".$catId."' order by position"); $cat = $db->fetched_array(); $smarty->assign("subcat",$cat[0]); $db->sql_query("select * from banners where sid='".$cat[0]['cid']."' order by position"); $slides = $db->fetched_array(); $smarty->assign("slides",$slides); $db->sql_query("select * from subcats where cid='".$cat[0]['cid']."' order by position"); $cat2 = $db->fetched_array(); $smarty->assign("subcats",$cat2); $db->sql_query("select * from products where cid='".$catId."' order by position"); $products = $db->fetched_array(); $smarty->assign("products",$products); $smarty->display("products.html"); ?>