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


PHP JHTMLMenu::TreeRecurse方法代碼示例

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


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

示例1: getInput

 function getInput()
 {
     $db =& JFactory::getDBO();
     $version = new JVersion();
     $odering = ", m.ordering";
     if ($version->RELEASE >= '3.0') {
         $odering = "";
     }
     $query = 'SELECT m.id, m.parent_id, m.title, m.menutype' . ' FROM #__menu AS m' . ' WHERE m.published = 1' . ' ORDER BY m.menutype, m.parent_id ' . $odering;
     $db->setQuery($query);
     $mitems = $db->loadObjectList();
     $mitems_temp = $mitems;
     $children = array();
     foreach ($mitems as $v) {
         $id = $v->id;
         $pt = $v->parent_id;
         $list = @$children[$pt] ? $children[$pt] : array();
         array_push($list, $v);
         $children[$pt] = $list;
     }
     $list = JHTMLMenu::TreeRecurse(intval($mitems[0]->parent_id), '', array(), $children, 9999, 0, 0);
     $mitems_spacer = $mitems_temp[0]->menutype;
     $mitems = array();
     if (@$all | @$unassigned) {
         $mitems[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('Menus'));
         if ($all) {
             $mitems[] = JHTML::_('select.option', 0, JText::_('All'));
         }
         if ($unassigned) {
             $mitems[] = JHTML::_('select.option', -1, JText::_('Unassigned'));
         }
         $mitems[] = JHTML::_('select.option', '</OPTGROUP>');
     }
     $lastMenuType = null;
     $tmpMenuType = null;
     foreach ($list as $list_a) {
         if ($list_a->menutype != $lastMenuType) {
             if ($tmpMenuType) {
                 $mitems[] = JHTML::_('select.option', '</OPTGROUP>');
             }
             $mitems[] = JHTML::_('select.option', '<OPTGROUP>', $list_a->title);
             $lastMenuType = $list_a->menutype;
             $tmpMenuType = $list_a->menutype;
         }
         $mitems[] = JHTML::_('select.option', $list_a->id, $list_a->treename);
     }
     if ($lastMenuType !== null) {
         $mitems[] = JHTML::_('select.option', '</OPTGROUP>');
     }
     $result = JHTML::_('select.genericlist', $mitems, $this->name . '[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $this->value);
     return $result;
 }
開發者ID:ChrisUmmen,項目名稱:joomladesign,代碼行數:52,代碼來源:menuitems.php

示例2: treerecurse

 function treerecurse($id, $indent, $list, &$children, $maxlevel = 9999, $level = 0, $type = 1)
 {
     if (@$children[$id] && $level <= $maxlevel) {
         foreach ($children[$id] as $v) {
             $id = $v->id;
             if ($type) {
                 $pre = '<sup>|_</sup>&nbsp;';
                 $spacer = '.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
             } else {
                 $pre = '- ';
                 $spacer = '&nbsp;&nbsp;';
             }
             if ($v->parent == 0) {
                 $txt = $v->name;
             } else {
                 $txt = $pre . $v->name;
             }
             $pt = $v->parent;
             $list[$id] = $v;
             $list[$id]->treename = "{$indent}{$txt}";
             $list[$id]->children = count(@$children[$id]);
             $list = JHTMLMenu::TreeRecurse($id, $indent . $spacer, $list, $children, $maxlevel, $level + 1, $type);
         }
     }
     return $list;
 }
開發者ID:RangerWalt,項目名稱:ecci,代碼行數:26,代碼來源:menu.php


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