本文整理汇总了PHP中tree::tree方法的典型用法代码示例。如果您正苦于以下问题:PHP tree::tree方法的具体用法?PHP tree::tree怎么用?PHP tree::tree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tree
的用法示例。
在下文中一共展示了tree::tree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cache_category
function cache_category($moduleid = 0, $data = array())
{
global $db, $DT, $MODULE;
if ($moduleid) {
if (!$data) {
$result = $db->query("SELECT * FROM {$db->pre}category WHERE moduleid='{$moduleid}' ORDER BY listorder,catid");
while ($r = $db->fetch_array($result)) {
$data[$r['catid']] = $r;
}
}
$mod = cache_read('module-' . $moduleid . '.php');
$a = array();
$d = array('listorder', 'moduleid', 'item', 'template', 'show_template', 'seo_title', 'seo_keywords', 'seo_description', 'group_list', 'group_show', 'group_add');
foreach ($data as $r) {
$e = $r['catid'];
foreach ($d as $_d) {
unset($r[$_d]);
}
$a[$e] = $r;
}
cache_write('category-' . $moduleid . '.php', $a);
if (count($data) < 100) {
$categorys = array();
foreach ($data as $id => $cat) {
$categorys[$id] = array('id' => $id, 'parentid' => $cat['parentid'], 'name' => $cat['catname']);
}
require_once DT_ROOT . '/include/tree.class.php';
$tree = new tree();
$tree->tree($categorys);
$content = $tree->get_tree(0, "<option value=\\\"\$id\\\">\$spacer\$name</option>") . '</select>';
cache_write('catetree-' . $moduleid . '.php', $content);
} else {
cache_delete('catetree-' . $moduleid . '.php');
}
} else {
foreach ($MODULE as $moduleid => $module) {
cache_category($moduleid);
}
}
}