Actions

Difference between revisions of "Creating a toolbar for your component"

From Joomla! Documentation

(New page: Note: This applies when using the MVC structure. <br /> By default the Joomla Toolbar uses a Delete, Edit, New, Publish, Unpublish and Parameters buttons. To use them in your component you...)
 
m (Added categorisation and syntax highlighting.)
Line 1: Line 1:
 
Note: This applies when using the MVC structure.
 
Note: This applies when using the MVC structure.
<br />
 
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).
 
<br />
 
  
 +
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).
 +
<source lang="php">
 
       JToolBarHelper::title( ''your_component_view_page_title'', 'generic.png' );
 
       JToolBarHelper::title( ''your_component_view_page_title'', 'generic.png' );
 
       JToolBarHelper::deleteList();
 
       JToolBarHelper::deleteList();
Line 11: Line 10:
 
       JToolBarHelper::unpublishList();
 
       JToolBarHelper::unpublishList();
 
       JToolBarHelper::preferences('your_component_xml_file', ''height'');
 
       JToolBarHelper::preferences('your_component_xml_file', ''height'');
 
+
</source>
 
+
 
So (i.e.) your code would look like this:
 
So (i.e.) your code would look like this:
 
+
<source lang="php">
 
  class HelloViewHellos extends JView
 
  class HelloViewHellos extends JView
 
  {
 
  {
Line 26: Line 24:
 
       JToolBarHelper::unpublishList();
 
       JToolBarHelper::unpublishList();
 
       JToolBarHelper::preferences('com_hello', '500');
 
       JToolBarHelper::preferences('com_hello', '500');
 +
</source>
  
 
+
[[Category:Development]]
I will add more info as soon as possible. Meanwhile use the forum for more answers for your questions.
+

Revision as of 11:44, 11 May 2009

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');