Esempio n. 1
0
<?php

include_once 'includes/class/basic/NEATCategory.class.php';
include_once 'includes/class/basic/NEATCache.class.php';
$db = new MySQL(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);
$NBS = new NEATBulidSql(TB_CATE);
$NC = new NEAT_CATEGORY();
$NCA = new NEAT_CACHE();
$NCA->setCachePath('tmp/');
$NCA->setCacheFile('categoryCache');
$NC->setTable(TB_CATE);
$catData['id'] = 'id';
$catData['pid'] = 'pid';
$catData['orderid'] = 'orderid';
$NC->setField($catData);
$NC->setNDB($db);
$NC->setNBS($NBS);
$NC->setNCA($NCA);
$getarray = $NC->readCategoryCache();
if (!is_array($getarray)) {
    $getarray = array();
}
foreach ($getarray as $k => $v) {
    !$i[$v['pid']] ? $i[$v['pid']] = 1 : $i[$v['pid']]++;
    $categoryPostion[$v['pid']][$v['id']] = $i[$v['pid']];
}
$last = '<img src=images/tree_ico/join.gif>&nbsp;&nbsp;';
$i = 0;
foreach ($getarray as $key => $val) {
    $num = count($categoryPostion[$val['pid']]);
    if ($categoryPostion[$val['pid']][$val['id']] == 1 and $categoryPostion[$val['pid']][$val['id']] != $num) {