Because our administrators will not have access to phpMyAdmin, we need to build a screen that lists all of the reviews in the database. Accomplishing this will involve creating another folder inside the views
folder and calling up the code from restaurants.php
. Until now, we've been using switch
statements to test the value of $task
and to call an appropriate function. You could keep doing this, but it would be more convenient for you to combine these tasks. Remove the code below the call to JTable::addIncludePath()
and insert the following code in its place:
jimport('joomla.application.component.controller'); class RestaurantsController extends JController { function add() { JRequest::setVar('view', 'single'); $this->display(); } function save() { JRequest::checkToken() or jexit( 'Invalid Token' ); global $option; $row =& JTable::getInstance('review', 'Table'); if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError() ); } $row...