0) { $row=mysql_fetch_assoc($result); $title=stripslashes($row['mtitle']); $mkeys=stripslashes($row['mkeys']); $mdesc=stripslashes($row['mdesc']); $content=stripslashes($row['text']); } } $result=mysql_query('select distinct t1.`id`,t1.`cat_level` from `categories` t1 inner join `categories` t2 on t2.`url`="/'.$page.'.html" where t1.`cat_left`<=t2.`cat_left` and t1.`cat_right`>=t2.`cat_right` and t1.`cat_level`<>0 '); if( @mysql_num_rows($result)>0 ) { $cids=array(); while($row=mysql_fetch_assoc($result)) $cids[$row['cat_level']]=$row['id']; $result=mysql_query('select `id`,`title`,`cat_left`,`cat_right`,`cat_level`,`url` from `categories` where `cat_level`="1" order by `cat_left`'); if(@mysql_num_rows($result)>0) { while($row=mysql_fetch_assoc($result)) { if($cids[1]==$row['id']) { $r=mysql_query('select `id`,`title`,`cat_left`,`cat_right`,`cat_level`,`url` from `categories` where `cat_left`>"'.$row['cat_left'].'" and `cat_right`<"'.$row['cat_right'].'" and `cat_level`="2" order by `cat_left`'); if(@mysql_num_rows($r)>0) $left.='
  • '; else $left.='
  • '; if($row['url']=='/'.$page.'.html') $left.=stripslashes($row['title']); else $left.=''.stripslashes($row['title']).''; if(@mysql_num_rows($r)>0) { $left.=''; } $left.='
  • '; } else $left.='
  • '.stripslashes($row['title']).'
  • '; } } } else { $result=mysql_query('select `id`,`title`,`url` from `categories` where `cat_level`="1" order by `cat_left`'); if(@mysql_num_rows($result)>0) while($row=mysql_fetch_assoc($result)) $left.='
  • '.stripslashes($row['title']).'
  • '; } $result=mysql_query('select * from `topmenu` order by `order`'); if(@mysql_num_rows($result)>0) while($row=mysql_fetch_assoc($result)) $top.=''.stripslashes($row['title']).''; @mysql_close(); $text=file_get_contents('templates/main.html'); $text=str_replace(array('%_TITLE_%','%_MKEYS_%','%_MDESC_%','%_HEAD_%','%_TOP_%','%_LEFT_%','%_CONTENT_%'), array($title,$mkeys,$mdesc,$head,$top,$left,$content),$text); print $text; ?>