Creating a toolbar for your component: Difference between revisions
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. | ||
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). | 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]] | |||
Revision as of 16: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');