EspañolEnglish (United Kingdom)

"Web Joomla a medida para tu empresa..."

rss facebook twitter digg youtube vimeo linkedin flickr
03
Jul
2010
Add the title tag to the menu of Joomla! PDF Print E-mail
Written by kim1   

Well today I'm going to write about adding the title attribute with this technique and any other attributes required and available on a link, this is a hack to Joomla! so we need to bear in mind that any update that affects the menu system will lead to ruin our work but sometimes you have to do these things even though we desire to please the customer.

The first thing to do is to add a new field to table # __menu in our database called "title" to put varchar (100) I guess it should be sufficient to include that field in the appropriate table object can be found in libraries / joomla / database / table / menu.php which add an additional property to the class and are thus:

  var $ title = null; 

Once this is done inputbox add a new menu in the administration and with that we will already have the administrative ready to accept this new field in the database, edit the file administrator / components / com_menus / views / item / form.php which we think we should add the field over this portion of code:

  <tr> 
  <td align="right"> 
  <? Php echo JText:: _ ('title');?>: 
  </ Td> 
  <td> 
  <Input type = "text" name = "title" size = "50" maxlength = "255" value = "<? Php echo $ this-> item-> title;?>" /> 
  </ Td> 
  </ Tr> 

Now it's the mod_mainmenu module in the frontend charge of showing the menu with links introduced on the backend, we will find it as not in modules / mod_mainmenu / helper.php, near the end of the code could find a switch with three cases, we will edit the two first, leaving them thus:

  default: 
  case 0: 
  / / _top 
  $ Data = '<a title="'.$tmp-> title.' "Href ="'.$ tmp-> url .'">'.$ image. $ Tmp-> name. '</ A>' ; 
  break; 
  case 1: 
  / / _blank 
  $ Data = '<a title="'.$tmp-> title.' "Href ="'.$ tmp-> url. '" Target = "_blank ">'.$ image. $ Tmp-> name." <Hobbies> '; 
  break; 

Thus in modern browsers and get a floating label with the title but we can embellish it a little more by adding some sort on the label <a> and javascript library jquery or other bubbles get editable css fantastic, in my case use VTIP jquery .


blog comments powered by Disqus
Last Updated on Saturday, 03 July 2010 01:03