<?
session_start();
require_once('../connect/connect.php'); 
include_once('../lib/lib.php');
require('pdk.php');
include_once('../cashe_n/_menu2.php');

$out='';
ob_start();
echo "<table>\n";

function get_tree_map2($parent_id, $prefix) {
      global $out;
      global $arr_menu;
	  $query = "SELECT * FROM catalog WHERE id_catalog > 0 AND parent_id = '".$parent_id."' ORDER BY num";
      $result = mysql_query($query);	
	  $nr = mysql_num_rows($result);  
	  
      while ($rr = mysql_fetch_array($result)) 
	  	{
		$out .= '<tr align=center>';
		$out .= '<td  align=left width="35%">';
		$out .= $prefix.'<img src="icon/folder.gif" border=0> <a href="catalog/'.$rr['url'].'_'.$rr['id_catalog'].'/all_0/">'.$rr['catalog'].'</a> '; 
		if($arr_menu[$rr['id_catalog']])
		$out .= '<br>'.$arr_menu[$rr['id_catalog']];
		get_tree_map2($rr['id_catalog'], $prefix."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
      	}
      return $out;
} // end function

echo get_tree_map2(0, "");
echo "</table>";

$buf = ob_get_contents();
ob_end_clean();

file_put_contents("../cashe_n/_menu.php", $buf);
echo '<a href="global.php">ОК</a>';
?>
