[Solved] Replacing old {sitemap} tag

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
User avatar
GSM
Forum Members
Forum Members
Posts: 19
Joined: Wed Aug 08, 2007 2:38 pm

[Solved] Replacing old {sitemap} tag

Post by GSM »

When I finally upgraded my site to 1.10.3 I ran into problems with the {sitemap} tag that was part of previous installations. I don't know when it was discontinued and replaced by the {site_mapper} tag. Anyway, during all the previous upgrades the {sitemap} tag had survived in the plugin folder and kept working fine. Only with last upgrade to version 1.10 the output contained a number of warnings because of the use of "split" function.

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>";
Hope some people find it helpful.
User avatar
pixelita
Power Poster
Power Poster
Posts: 388
Joined: Sun Sep 16, 2007 3:07 am

Re: [Solved] Replacing old {sitemap} tag

Post by pixelita »

I'd been using the old sitemap tag too and wondered what I was going to do about that, since I do use it on quite a few non profit sites.

Wonder no more! Ferris Bueller, you're my hero! <3
Submit your site to the We Love CMSMS showcase
Locked

Return to “[locked] Installation, Setup and Upgrade”