Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

Migrating toolbars to views


When we first built out the backend, we added toolbars to the top of the restaurants.php file and decided which one to display by using a switch() statement. This was okay for testing, but it will make maintenance a bit unpleasant. Now that we have views in place, we can place our toolbars directly in them. Take the toolbar code from the default: case in restaurants.php and add it to views/all/tmpl/default.php:

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
JToolBarHelper::title( JText::_( 'Restaurant Reviews' ), 'generic.png' );
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::editList();
JToolBarHelper::deleteList('Are you sure you want to delete reviews?');
JToolBarHelper::addNew();

?>
<form action="index.php" method="post" name="adminForm">

Next, do the same for the edit and add tasks on the single view. Cut the toolbar code and paste it into views/single/tmpl/default.php:

JHTML::_('behavior.calendar...