Web设计类资料

这里集中的是所有Web设计类的资料,下面是展开的目录:

<?php
$book_top_page = 1405;
$levels_deep = 10;
$emulate_book_block = true;

if (!function_exists('book_struct_recurse')){
function book_struct_recurse($nid, $levels_deep, $children, $current_lineage = array(), $emulate_book_block = true) {
$struct = '';
if ($children[$nid] && ($levels_deep > 0 || ($emulate_book_block && in_array($nid, $current_lineage)))) {
$struct = '

    ';
    foreach ($children[$nid] as $key => $node) {
    if ($tree = book_struct_recurse($node->nid, $levels_deep - 1, $children, $current_lineage, $emulate_book_block)) {
    $struct .= '
  1. ';
    $struct .= l($node->title, 'node/'. $node->nid);
    $struct .= $tree;
    $struct .= '
  2. ';
    }
    else {
    if ($children[$node->nid]){
    $struct .= '

  3. '. l($node->title, 'node/'. $node->nid) .'
  4. ';
    }
    else {
    $struct .= '

  5. '. l($node->title, 'node/'. $node->nid) .'
  6. ';
    }
    }
    }
    $struct .= '

';
return $struct;
}
}
}

$current_lineage = array();

// use this version for Drupal 4.6
// $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE n.status = 1 ORDER BY b.weight, n.title'));

// use this version for Drupal 4.7 and Drupal 5
$result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.nid = b.nid AND n.vid = b.vid WHERE n.status = 1 ORDER BY b.weight, n.title'));

while ($node = db_fetch_object($result)) {
if (!$children[$node->parent]) {
$children[$node->parent] = array();
}
array_push($children[$node->parent], $node);

if (arg(0) == 'node' && is_numeric(arg(1)) && arg(1) == $node->nid) {
$_temp = book_location($node);
foreach ($_temp as $key => $val){
$current_lineage[] = $val->nid;
}
$current_lineage[] = arg(1);
}
}

echo book_struct_recurse($book_top_page, $levels_deep, $children, $current_lineage, $emulate_book_block);
?>