當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tree::getLayer方法代碼示例

本文整理匯總了PHP中Tree::getLayer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tree::getLayer方法的具體用法?PHP Tree::getLayer怎麽用?PHP Tree::getLayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tree的用法示例。


在下文中一共展示了Tree::getLayer方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getmodelcachecategory

/**
 * 從緩存中獲得模型分類
 */
function getmodelcachecategory($categoryarr, $space = '|----', $delbase = 0)
{
    include_once S_ROOT . './class/tree.class.php';
    $tree = new Tree('');
    $miniupid = 0;
    $delid = array();
    if ($delbase) {
        $delid[] = $delbase;
    }
    $listarr = array();
    if (!empty($categoryarr)) {
        foreach ($categoryarr as $value) {
            $tree->setNode($value['catid'], $value['upid'], $value);
        }
        //根目錄
        $carr = $tree->getChilds($miniupid);
        foreach ($carr as $key => $catid) {
            $cat = $tree->getValue($catid);
            $cat['pre'] = $tree->getLayer($catid, $space);
            if (!empty($delid) && (in_array($cat['upid'], $delid) || $cat['catid'] == $delbase)) {
                $delid[] = $cat['catid'];
            } else {
                $listarr[$cat['catid']] = $cat;
            }
        }
    }
    return $listarr;
}
開發者ID:superman1982,項目名稱:ng-cms,代碼行數:31,代碼來源:model.func.php

示例2: updateMenu

include '../common.inc.php';
include 'global.php';
include ROOT_PATH . 'include/tree.class.php';
function updateMenu()
{
    $menu = $GLOBALS['tree']->getChilds(1);
    array_splice($menu, -6);
    foreach ($menu as $k => $v) {
        $_menu[$v['cid']] = $v;
        unset($menu[$k]);
    }
    writetofile(ROOT_PATH . 'admin/_menu.php', '$MENUS = ' . var_export($_menu, true));
}
$tree = new Tree('category');
$cate = $tree->getChilds(1);
$menu = $tree->getLayer($cate);
if (basename(__FILE__, '.php') == 'menu') {
    if ($act == 'save') {
        $sort_order = empty($sort_order) ? 0 : intval($sort_order);
        $name = addslashes(trim($name));
        $content = addslashes(trim($content));
        if ($do == 'add') {
            $tree->addNode($cid, $name, $content, $sort_order);
        } else {
            $sql = "UPDATE `" . $tree->tablepre . $tree->table . "` SET name='{$name}',content='{$content}',sort_order='{$sort_order}'" . " WHERE cid={$cid}";
            $db->query($sql);
        }
        updateMenu();
        header("Location: menu.php");
    } elseif ($act == 'edit') {
        $row = $tree->getValue($cid);
開發者ID:haseok86,項目名稱:millkencode,代碼行數:31,代碼來源:menu.php

示例3: getbbsforum

function getbbsforum($isblog = 0, $space = '|----')
{
    global $_SGLOBAL;
    dbconnect(1);
    $forumarr = array();
    if ($isblog) {
        $wheresql = ' AND (type=\'group\' || allowshare=\'1\')';
    } else {
        $wheresql = '';
    }
    include_once S_ROOT . './class/tree.class.php';
    $tree = new Tree('blog');
    $minfup = '';
    $query = $_SGLOBAL['db_bbs']->query('SELECT * FROM ' . tname('forums', 1) . ' WHERE status>0' . $wheresql . ' ORDER BY fup, displayorder');
    while ($forum = $_SGLOBAL['db_bbs']->fetch_array($query)) {
        if ($minfup == '') {
            $minfup = $forum['fup'];
        }
        $tree->setNode($forum['fid'], $forum['fup'], $forum);
    }
    //根目錄
    $listarr = array();
    $categoryarr = $tree->getChilds($minfup);
    foreach ($categoryarr as $key => $catid) {
        $cat = $tree->getValue($catid);
        $cat['pre'] = $tree->getLayer($catid, $space);
        $listarr[$cat['fid']] = $cat;
    }
    return $listarr;
}
開發者ID:hongz1125,項目名稱:devil,代碼行數:30,代碼來源:admin.func.php

示例4: getmodelcategory

function getmodelcategory($name, $space = '|----')
{
    global $_SGLOBAL;
    include_once S_ROOT . './class/tree.class.php';
    $tree = new Tree($name);
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('categories') . ' WHERE `type`=\'' . $name . '\' ORDER BY upid, displayorder');
    $miniupid = '';
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($miniupid == '') {
            $miniupid = $value['upid'];
        }
        $tree->setNode($value['catid'], $value['upid'], $value);
    }
    //¸ùĿ¼
    $listarr = array();
    if ($_SGLOBAL['db']->num_rows($query) > 0) {
        $categoryarr = $tree->getChilds($miniupid);
        foreach ($categoryarr as $key => $catid) {
            $cat = $tree->getValue($catid);
            $cat['pre'] = $tree->getLayer($catid, $space);
            $listarr[$cat['catid']] = $cat;
        }
    }
    return $listarr;
}
開發者ID:hongz1125,項目名稱:devil,代碼行數:25,代碼來源:common.func.php

示例5: TableClass

include "common.inc.php";
InitGP(array("action", "tid", "gid", "ps", "page"));
//初始化變量全局返回
$goodsobj = new TableClass('shop_goods', 'gid');
$typeobj = new TableClass('shop_gtype', 'typeid');
//讀取分類信息
$typearray = $typeobj->getdata('', '', 'typeid asc');
include_once INC_PATH . '/tree.class.php';
$tree = new Tree($typearray, 'typeid', 'node');
//分類處理
$categoryarr = $tree->getChilds(0);
$space = '|----';
foreach ($categoryarr as $key => $catid) {
    $cat = $tree->getValue($catid);
    $cat['pre'] = $tree->getLayer($catid, $space);
    $listarr[$cat['typeid']] = $cat;
}
//讀取分類結束
if ($action == 'list') {
    $tid = GetNum($tid);
    $gtype = $tree->getValue($tid);
    if ($gtype['node'] == 0) {
        $position = "<span>&gt;</span><a href='shop.php?action=list&tid=" . $gtype['typeid'] . "'>" . $gtype['typename'] . "</a>";
        $typename = $gtype['typename'];
    } else {
        $cgtype = $tree->getValue($gtype['node']);
        $typename = $cgtype['typename'];
        $position = "<span>&gt;</span><a href='shop.php?action=list&tid=" . $cgtype['typeid'] . "'>" . $cgtype['typename'] . "</a>";
        $position .= "<span>&gt;</span><a href='shop.php?action=list&tid=" . $gtype['typeid'] . "'>" . $gtype['typename'] . "</a>";
    }
開發者ID:dalinhuang,項目名稱:c2my,代碼行數:30,代碼來源:shop.php


注:本文中的Tree::getLayer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。