'cleft', 'right'=> 'cright', 'level'=> 'clevel', ); require_once "database.php"; require_once "dbtree.php"; function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $dbh=new CDataBase("extrem", "localhost", "extrem", "9gvs7AbI"); $dbh->query("set names cp1251"); $Tree = new CDBTree($dbh, $table, $id_name, $field_names); $ID = (isset($_GET['ID'])) ? $_GET['ID'] : 1; $time_start = microtime_float(); if(!(list($leftId, $rightId, $level) = $Tree->getNodeInfo($ID))){} // $sql = "select a.* from $table a left join $table b on (b.cleft<=$leftId and b.cright >=$rightId and b.clevel=a.clevel-1) where (a.cleft>=b.cleft and a.cright <=b.cright) order by a.cleft asc"; $sql = "select a.* from $table a order by a.cleft asc"; $res = $dbh->query($sql); while ($row = $dbh->fetch_array($res)){ echo str_repeat(" ", 6*$row['clevel']); switch($row['clevel']){ case 0 :$size = 10; break; case 1 :$size = 6; break; case 2 :$size = 4; break; default : $size = 2; break; } echo ""; echo $row['title']; echo "
"; } $time_end = microtime_float(); $time = $time_end - $time_start; echo "Âðåìÿ âûâîäà: $time ñåê.\n"; ?>