Tuesday, 21 October 2014 08:48
beggarly

Configurable header tag type

Request new features on Xmap component
Forum rules
This

Configurable header tag type

Postby doorknob » Sat Jan 02, 2010 8:59 am

I wanted to be able to use a header tag different from h2, so I made the following patch (to v1.2.6). While I was making the changes, I found that the program xmap.php tries to load the 'sitemap' parameter from the xmap menu item but the metadata.xml file is only configured to include this value in the url and not as a parameter. I changed this file so that both the existing parameter 'sitemap' and the new one I added for the header tag type are both stored as parameters. With this patch, the type of tag used for headers on the page can be configured from a drop down list but defaults to the currently hard coded value.
The code change I made to xmap.html.php was as follows:
After:
Code: Select all
   var $_isAdmin = 0;

(around line 22) add:
Code: Select all
   var $_header_type;

After
Code: Select all
   function XmapHtml (&$config, &$sitemap) {

(around line 25) add
Code: Select all
      global $Itemid;

      $menu = JSite::getMenu();
      $menuparams = $menu->getParams( $Itemid );
      $this->_header_type = $menuparams->get('header_type', 'h2');

Around line 250, replace
Code: Select all
         echo '<h2 class="menutitle">'.$menu->name.'</h2>';

with
Code: Select all
         echo '<'.$this->_header_type.' class="menutitle">'.$menu->name.'</'.$this->_header_type.'>';


Attached is a zip with the revised metadata.xml file and the patched program file
Regards
Phil
Attachments
xmap_patch_header_type.zip
(3.89 KiB) Downloaded 552 times
doorknob
Junior Boarder
Junior Boarder
 
Posts: 27
Joined: Thu Aug 07, 2008 9:30 pm

Return to New Features



Who is online

Users browsing this forum: No registered users and 1 guest