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

Displaying a review


If you were to click on any of the links at the moment, you would get a "500" error similar to the one below:

This is because we have not yet added the single view. By now, you are probably comfortable with creating the directory and file structure for a new view you simply add the name of the view as a folder under views, and then create view.html.php and tmpl/default.php within this folder. Add this code for the view in the view.html.php file:

<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
JTable::addIncludePath(JPATH_ADMINISTRATOR. DS.'components'.DS.'com_restaurants'.DS.'tables');
class RestaurantsViewSingle extends JView
{
function display($tpl = null)
{
$id = (int) JRequest::getVar('id', 0);
$review =& JTable::getInstance('review', 'Table');
$review->load($id);
if ($review->published == 0) {
JError::raiseError(404,
'The review you requested is not available.' );
}
if ($review->smoking == 1...