Index: trunk/themes/default/common/footer.tpl =================================================================== diff -u -r1358 -r1364 --- trunk/themes/default/common/footer.tpl (.../footer.tpl) (revision 1358) +++ trunk/themes/default/common/footer.tpl (.../footer.tpl) (revision 1364) @@ -8,7 +8,7 @@
Powered by In-portal ® 1997-2005, Intechnic Corporation. All rights reserved.                             - " style="color: #FFFFFF; text-decoration : none;">Site Map + " style="color: #FFFFFF; text-decoration : none;">
Index: trunk/kernel/parser.php =================================================================== diff -u -r1343 -r1364 --- trunk/kernel/parser.php (.../parser.php) (revision 1343) +++ trunk/kernel/parser.php (.../parser.php) (revision 1364) @@ -3541,6 +3541,196 @@ return GetRegionalOption($attribs['_name']); } +/* + @description: Returns a sitemap + @attrib: _CatId:int: Top Level Catagory ID to start sitemap with. + @attrib: _ModuleName:: Module name (optional, default none) + @attrib: _MainItemTemplate:tpl: Item template for Top level category + @attrib: _SubCatItemTemplate:tpl: Item template for Sub categories + @attrib: _MaxDepth:: Max Depth, default all, minimum 2 +*/ +function m_sitemap($attribs = array()) +{ + global $objModules; + + $html_attribs = ExtraAttributes($attribs); + + $mod_name = getArrayValue($attribs, "_modulename"); + $StartCatId = getArrayValue($attribs, "_catid"); + $MaxDepth = (int)getArrayValue($attribs, "_maxdepth"); + if ($MaxDepth == 0) + unset($MaxDepth); + elseif ($MaxDepth < 2) + $MaxDepth = 2; + + $MainItemTemplate = getArrayValue($attribs, "_mainitemtemplate"); + $SubCatItemTemplate = getArrayValue($attribs, "_subcatitemtemplate"); + + if (!strlen($SubCatItemTemplate)) + $SubCatItemTemplate = "sitemap_subcat_element"; + + if (!strlen($MainItemTemplate)) + $MainItemTemplate = "sitemap_cat_element"; + + + $cols = getArrayValue($attribs, "_columns"); + $cols = ($cols<1)? 2 : $cols; + + if (!isset($StartCatId)) + { + if (!strlen($mod_name)) + { + $_RootCat = 0; + } + else + { + $_RootCat = $objModules->GetModuleRoot($mod_name); + } + } + else + { + $_RootCat = (int)$StartCatId? (int)$StartCatId : 0; + } + + // Get Root Categories of all installed Modules + if (is_array($objModules->Items)) + { + foreach ($objModules->Items as $curr_mod) + { + if ($curr_mod->Get("Name") != "In-Portal") + { + $mod_name = (int)$curr_mod->Get("RootCat"); + if (!empty($mod_name)) + { + if (!isset($modules[$mod_name])) + $modules[$mod_name] = $curr_mod->Get("TemplatePath"); + else + $modules[$mod_name] = ""; + } + else + $modules[$mod_name] = ""; + } + } + } + + $_C_objCat = new clsCatList(); + $_Where = GetTablePrefix()."Category.ParentId=$_RootCat"; + $_C_catList = $_C_objCat->LoadCategories($_Where, "", false); + + ## getting TOP level categories + if (is_array($_C_catList) && count($_C_catList)) + { + $ret = ""; + $ret.= ""; + $ret.= "\n
"; + + $CatCount = $_C_objCat->NumCategories(); + $per_row = ceil($CatCount/$cols); + + + foreach ($_C_catList as $cat) + { + $text = $cat->Get("Name"); + $val = $cat->Get("CategoryId"); + $sub_path = $cat->Get("ParentPath"); + + $add_path = ""; + if (is_array($modules)) + { + foreach ($modules as $curr => $v) + { +// echo "MOD_CAT: $curr PATH: $sub_path TEMPL: $v
"; + if (strpos($sub_path, "|$curr|") !== false) + { + $add_path = $v; + break; + } + } + } + + $main_templ = $add_path.$MainItemTemplate; +// echo "TEMPL: $main_templ
"; + $ret.= $cat->ParseTemplate($main_templ); + + $count++; + $row++; + + $_C_objCatSubs = new clsCatList(); + + if (empty($_RootCat)) + $ParentPath = "|$val|%"; + else + $ParentPath = "|$_RootCat|$val|%"; + + $_Where = GetTablePrefix()."Category.ParentPath LIKE '$ParentPath' AND ".GetTablePrefix()."Category.CategoryId!=$val"; + $_OrderBy = " ORDER BY ".GetTablePrefix()."Category.ParentPath ASC, ".GetTablePrefix()."Category.Name ASC"; + $SubCats = $_C_objCatSubs->LoadCategories($_Where, $_OrderBy); + + if (is_array($SubCats) && count($SubCats)) + { +// echo "COUNT: ".count($SubCats); + foreach ($SubCats as $subcat) + { + $SubCatName = $subcat->Get("Name"); + $SubCatId = $subcat->Get("CategoryId"); + + $SubPath = $subcat->Get("ParentPath"); + + $add_path = ""; + if (is_array($modules)) + { + foreach ($modules as $curr => $v) + { +// echo "MOD_CAT: $curr PATH: $SubPath TEMPL: $v
"; + if (strpos($SubPath, "|$curr|") !== false) + { + $add_path = $v; + break; + } + } + } + + $CatIds = $subcat->GetParentIds(); + + $nbs = ""; + + if (!isset($MaxDepth) || (isset($MaxDepth) && ($MaxDepth >= count($CatIds)))) + { + for ($i = (count($CatIds)-2); $i>0; $i--) + $nbs.= "        "; + + $sub_templ = $add_path.$SubCatItemTemplate; + // echo "TEMPL: $sub_templ
"; + $ret.= $nbs.$subcat->ParseTemplate($sub_templ); + } + } + } + else + { + echo "Empty"; + } + + + unset($_C_objCatSubs); + + if($count==$per_row) + { + $ret.= "
"; + $count=0; + } + else + $ret.= "
"; + } + + if($count != $per_row) + $ret .= "
\n"; + + } + + return $ret; +} + + /*function m_object($attribs=Array()) { $element = new clsHtmlTag(); Index: trunk/themes/default/sitemap.tpl =================================================================== diff -u --- trunk/themes/default/sitemap.tpl (revision 0) +++ trunk/themes/default/sitemap.tpl (revision 1364) @@ -0,0 +1,82 @@ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + +

+ + + + + + +

+ + + + + + + +
" width="18" height="12" alt="" />
   
+
+ +
+ + + +

+ + + + + + +

+ + +

+
+ + + Index: trunk/themes/default/index/sitemap_subcat_element.tpl =================================================================== diff -u --- trunk/themes/default/index/sitemap_subcat_element.tpl (revision 0) +++ trunk/themes/default/index/sitemap_subcat_element.tpl (revision 1364) @@ -0,0 +1,3 @@ + +&reset=1"> +
\ No newline at end of file