Talk

Difference between revisions of "JToolBarHelper/title"

From Joomla! Documentation

(Created page with "Changed this because it's misleading. The method itself is a bit confusing because it seems to imply linking to a file through its parameter defaults but does not. JToolBarHelp...")
 
Line 1: Line 1:
 
Changed this because it's misleading.  The method itself is a bit confusing because it seems to imply linking to a file through its parameter defaults but does not.  JToolBarHelper assigns a custom class to the title.  This allows the developer to hook in their own image via a stylesheet.  See full function below:
 
Changed this because it's misleading.  The method itself is a bit confusing because it seems to imply linking to a file through its parameter defaults but does not.  JToolBarHelper assigns a custom class to the title.  This allows the developer to hook in their own image via a stylesheet.  See full function below:
 +
 +
 +
<nowiki>
  
 
public static function title($title, $icon = 'generic.png')
 
public static function title($title, $icon = 'generic.png')
Line 14: Line 17:
 
$app->set('JComponentTitle', $html);
 
$app->set('JComponentTitle', $html);
 
}
 
}
 +
</nowiki>

Revision as of 12:16, 25 August 2011

Changed this because it's misleading. The method itself is a bit confusing because it seems to imply linking to a file through its parameter defaults but does not. JToolBarHelper assigns a custom class to the title. This allows the developer to hook in their own image via a stylesheet. See full function below:


public static function title($title, $icon = 'generic.png') { // Strip the extension. $icons = explode(' ',$icon); foreach($icons as &$icon) { $icon = 'icon-48-'.preg_replace('#\.[^.]*$#', '', $icon); } $html = '<div class="pagetitle '.implode(' ', $icons).'"><h2>'.$title.'</h2></div>'; $app = JFactory::getApplication(); $app->set('JComponentTitle', $html); }