本文整理汇总了PHP中common_node::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP common_node::getChildren方法的具体用法?PHP common_node::getChildren怎么用?PHP common_node::getChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_node
的用法示例。
在下文中一共展示了common_node::getChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateTabsMenu
/**
* generateTabsMenu
*/
public function generateTabsMenu($node_id)
{
if (!is_numeric($node_id)) {
return false;
}
require_once 'models/common/common_node.php';
$Node = new common_node();
/**
* get list of children
*/
$children = $Node->getChildren($node_id, 'priority DESC, id ASC');
if (!is_array($children)) {
return false;
}
/**
* filter only published items
*/
$children_published = array();
foreach ($children as $item) {
if ($item['publish'] == 1) {
$children_published[] = $item;
}
}
/**
* show only if any items are left
*/
if (is_array($children_published) && count($children_published) > 0) {
$total_count = count($children_published);
foreach ($children_published as $k => $item) {
$first_last = '';
if ($k == 0) {
$first_last = 'first';
}
if ($k == $total_count - 1) {
$first_last .= ' last';
}
$this->tpl->assign('FIRST_LAST', $first_last);
$this->tpl->assign('ITEM', $item);
$this->tpl->parse('content.menu.item');
}
$this->tpl->parse('content.menu');
}
return true;
}
示例2: mainAction
/**
* main action
*/
public function mainAction()
{
require_once 'models/common/common_node.php';
if (!is_numeric($this->GET['id'])) {
msg('node_child: id is not numeric', 'error');
return false;
}
$Node = new common_node();
$node_detail = $Node->getDetail($this->GET['id']);
if (!is_array($node_detail)) {
msg("node_child: Node not found", 'error');
return false;
}
/**
* set node group as parent if not provided
*/
if ($this->GET['node_group'] != '') {
$this->tpl->assign('NODE_GROUP', $this->GET['node_group']);
} else {
$this->tpl->assign('NODE_GROUP', $node_detail['node_group']);
}
$this->tpl->assign("NODE", $node_detail);
//get children
$children = $Node->getChildren($node_detail['id']);
if (is_array($children) && count($children) > 0) {
foreach ($children as $child) {
if ($child['publish'] == 0) {
$child['class'] = 'disabled';
}
$this->tpl->assign("CHILD", $child);
$this->tpl->parse('content.children.item');
}
$this->tpl->parse('content.children');
} else {
$this->tpl->parse('content.empty');
}
return true;
}
示例3: getPageChildren
public function getPageChildren($parent)
{
$Node = new common_node();
return $Node->getChildren($parent);
}