I had used {sitemap} quite extensively in my pages to list sub pages. I first thought of replacing if with {site_mapper} but I realised that the new tag has no parameters to select what to show and how (class). Looking at the description I noted the new tag is anyway just a shortcut to the {menu} tag. Thus I decided to write an UDT {sitemap} that mirrors the old functionality and saves the hazzle of changing all pages that used the old tag.
This UDT uses a menu template called "Sitemap" which is based on the "minimum_menu.tpl" template.
Code: Select all
$gCms = cmsms(); //global $gCms;
$smarty = &$gCms->GetSmarty();
if ($params['start_element']<>'') { $start = "start_element='".$params['start_element']."'"; }
if ($params['number_of_levels']<>'') {
$levels = "number_of_levels='".$params['number_of_levels']."'";
} else {
$start = "childrenof='".$params['start_element']."'";
}
$smarty_data = "{menu template='Sitemap' ".$start." ".$levels."}";
$smarty->_compile_source('temporary template', $smarty_data, $_compiled );
@ob_start();
$smarty->_eval('?>' . $_compiled);
$_contents = @ob_get_contents();
@ob_end_clean();
echo "<div class='".$params['class']."'>".$_contents."</div>";