/** * nv_smenu_blocks() * Hien thi menu con * * @param mixed $style * @param mixed $list_cats * @param mixed $list_sub * @return * */ function nv_smenu_blocks($style, $list_cats, $list_sub, &$submenu_active, $block_theme) { $xtpl = new XTemplate($style . '.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/menu'); if (empty($list_sub)) { return ''; } else { $list = explode(',', $list_sub); foreach ($list_cats as $cat) { $catid = $cat['id']; if (in_array($catid, $list)) { $list_cats[$catid]['class'] = nv_menu_blocks_active($list_cats[$catid]); if ($list_cats[$catid]['current'] === true) { $submenu_active[] = $catid; } $xtpl->assign('MENUTREE', $list_cats[$catid]); if (!empty($list_cats[$catid]['icon'])) { $xtpl->parse('tree.icon'); } if (!empty($list_cats[$catid]['subcats'])) { $tree = nv_smenu_blocks($style, $list_cats, $list_cats[$catid]['subcats'], $submenu_active, $block_theme); $xtpl->assign('TREE_CONTENT', $tree); $xtpl->parse('tree.tree_content'); } $xtpl->parse('tree'); } } return $xtpl->text('tree'); } }
/** * nv_smenu_blocks() * * Hien thi menu con * * @param mixed $style * @param mixed $list_cats * @param mixed $list_sub * @return */ function nv_smenu_blocks($style, $list_cats, $list_sub) { global $global_config; if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/menu/' . $style . '.tpl')) { $block_theme = $global_config['module_theme']; } elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/menu/' . $style . '.tpl')) { $block_theme = $global_config['site_theme']; } else { $block_theme = 'default'; } $xtpl = new XTemplate($style . '.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/menu'); if (empty($list_sub)) { return ''; } else { $list = explode(',', $list_sub); foreach ($list_cats as $cat) { $catid = $cat['id']; if (in_array($catid, $list)) { $list_cats[$catid]['class'] = nv_menu_blocks_active($list_cats[$catid]); $xtpl->assign('MENUTREE', $list_cats[$catid]); if (!empty($list_cats[$catid]['icon'])) { $xtpl->parse('tree.icon'); } if (!empty($list_cats[$catid]['subcats'])) { $tree = nv_smenu_blocks($style, $list_cats, $list_cats[$catid]['subcats']); $xtpl->assign('TREE_CONTENT', $tree); $xtpl->parse('tree.tree_content'); } $xtpl->parse('tree'); } } return $xtpl->text('tree'); } }