Actions

Creating a toolbar for your component

From Joomla! Documentation

Revision as of 18:10, 3 May 2009 by VisiGod (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: This applies when using the MVC structure.
By default the Joomla Toolbar uses a Delete, Edit, New, Publish, Unpublish and Parameters buttons. To use them in your component you must write the following code in the view.html.php of your view file (below your display function).

     JToolBarHelper::title( your_component_view_page_title, 'generic.png' );
     JToolBarHelper::deleteList();
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::preferences('your_component_xml_file', height);


So (i.e.) your code would look like this:

class HelloViewHellos extends JView
{
  function display($tpl = null) {
     global $mainframe, $option;
     JToolBarHelper::title( 'Hello Component', 'generic.png' );
     JToolBarHelper::deleteList();
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::preferences('com_hello', '500');


I will add more info as soon as possible. Meanwhile use the forum for more answers for your questions.