Hello Parvus,
Parvus wrote:
I try to use JToolbarHelper::title to display a title and a custom png image file.
The title works - duhuh - but the image file does not show up.
Where do those images need to reside? Can I configure this? Do I need to include something or register something somewhere beforehand? Are there size constraints?
Are these questions already answered somewhere? I could not find them.
A call such and
Code:
JToolbarHelper::title(JText::_('Some Title'), 'generic.png');
looks for the generic.png file in the administrator/images directory. If you want yours to be displayed then you'll probably want to create a images directory for your component/module etc... and then change the call to
Code:
JToolbarHelper::title(JText::_('Some Title'), JPATH_COMPONENT.DS.'com_mycomponent'.DS.'images'.DS.'mytoolbar_title.png');
Might be a shorter path statement available but couldn't find anything under JApplicationHelper::getPath. Although assuming that you have this call in a file called admin.mycomponent.html.php,
Code:
class TOOLBAR_foo
{
function _DEFAULT(){
JToolBarHelper::title(JText::_("My Component"), dirname(__FILE__).DS.'images'.DS.'mytoolbar_title.png');
}
}
Should work out as well, assuming of course a com_mycomponent/images directory and a mytoolbar_title.png file in that directory...
JW
PS. I stand corrected. The code strips everthing from the icon parameter and as mentioned below you need to add a line to the icons.css file of your template such as...
Code:
.icon-48-mytoobar_title { background-image: url(../images/header/icon-48-mytoolbar_title.png); }
And your admin.mycomponent.html.php call should be..
Code:
class TOOLBAR_foo
{
function _DEFAULT(){
JToolBarHelper::title(JText::_("My Component"), 'mytoolbar_title');
}
}
Thanks sectuer