function getTreeAss($parentid, &$array_cat, &$html) { $db =& JFactory::getDBO(); $query = ' SELECT id, parentid, name, ordering, published FROM #__w_cat_accessories ' . ' WHERE parentid = ' . $parentid . ' and published = 1' . ' ORDER BY ordering'; $db->setQuery($query); $cats = $db->loadObjectList(); if ($cats == NULL) { return NULL; } else { $i = 1; if ($parentid > 0) { $html .= '<ul>'; } $j = 1; $p = 1; foreach ($cats as $cat) { $titleCatName = JFilterOutput::stringURLSafe($cat->name); $titleCatName = str_replace(' ', '-', strtolower(trim($titleCatName))); $link = JRoute::_('index.php?option=com_products&controller=accessory&catid=' . $cat->id . ':' . $titleCatName); if ($cat->parentid == 0) { $p++; if ($p > 2) { $p_class = 'p_li'; } else { $p_class = ''; } $html .= '<li class="cat_parent ' . $p_class . '">' . '<a class="a_parent" href="' . $link . '">' . $cat->name . '</a>'; $j = 1; } else { $p = 1; $html .= '<li class="cat_item stt_' . $j . '">' . '<a href="' . $link . '">' . $cat->name . '</a>'; $j++; } $array_cat[] = $cat; modPhuKienMenuHelper::getTreeAss($cat->id, $array_cat, $html); $i++; $html .= '</li>'; } if ($parentid > 0) { $html .= '</ul>'; } } return $html; }
<?php /** * @version 1.0 - Joomla 1.5.x * @package Module Cat Menu Products * @copyright Wampvn Group * @license GNU/GPL * @website http://wampvn.com * @description index. */ // no direct access defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once // require_once ('modules/mod_phukienmenu/helper.php'); //$catmenus = modPhuKienMenuHelper::getPhuKienMenu(&$params); require_once 'modules/mod_phukienmenu/helper.php'; $catmenus = array(); $menua = ''; $menua = modPhuKienMenuHelper::getTreeAss(0, $catmenus, $menua); require JModuleHelper::getLayoutPath('mod_phukienmenu'); ?>