Custom toolbar buttons

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
User avatar
Sergey Romanov
I've been banned!
Posts: 279
Joined: Thu Dec 01, 2005 11:32 am
Location: Kyrgyzstan
Contact:

Custom toolbar buttons

Post by Sergey Romanov » Tue Aug 07, 2007 12:55 pm

Before I did like this

Code: Select all

<?php
$html = "<a href=\"javascript:void(0);\" onclick=\"javascript:".
            "document.adminForm.filter_order.value=''; submitbutton('$task');\" class=\"toolbar\">";
$html .= "<span class=\"icon-32-cancel\" type=\"Standard\">";
$html .= "</span>";
$html .= jcText::_($string);
$html .= "</a>";
$bar = & JToolBar::getInstance('JComponent');
$bar->appendButton( 'Custom', $html, 'close' );
?>
Now it does not work and I do not know where to look an example.

User avatar
ianmac
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4784
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Custom toolbar buttons

Post by ianmac » Tue Aug 07, 2007 5:55 pm

You now need to use 'toolbar' instead of 'JComponent'.  You can also leave 'toolbar' out because this is the default value for getInstance().

Ian

User avatar
Sicarii
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 174
Joined: Fri Aug 19, 2005 6:11 am
Location: Oamaru,New Zealand

Re: Custom toolbar buttons

Post by Sicarii » Tue Aug 07, 2007 10:30 pm

While on the topic of toolbars, how do you change the icons to there own custom ones?

Code: Select all

JToolBarHelper::title( 'text-here', 'custom-icon.png' );
Or have I missed something.... ;)

User avatar
Sergey Romanov
I've been banned!
Posts: 279
Joined: Thu Dec 01, 2005 11:32 am
Location: Kyrgyzstan
Contact:

Re: Custom toolbar buttons

Post by Sergey Romanov » Wed Aug 08, 2007 12:33 pm

@ianmac
Thank you very much

@Sicarii
No. In custom HTML, in element you create class. In my case it is lass="icon-32-cancel". Then you need to add either link to your CSS

Code: Select all

<?php 
$document =& JFactory::getDocument();
$document->addStyleSheet('components/com_jcommerce/css/general.css'); 
?>
file where you declare

Code: Select all

.icon-32-cancel{
	background-image: url(images/toolbar/kmenuedit.png);
	background-repeat: no-repeat;
}


Locked

Return to “Joomla! 1.5 Coding”