本文整理匯總了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);
}