In components/com_zoo/views/item create a view.pdf.php file. Into that file, copy the following code.
Code: Select all
<?php
/**
* @version $Id: view.pdf.php 11371 2008-12-30 01:31:50Z ian $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
/**
* HTML Article View class for the Content component
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class ZooViewItem extends YView {
function display($tpl = null) {
global $mainframe, $Itemid;
// get dispatcher
JPluginHelper::importPlugin('zoo');
$dispatcher =& JDispatcher::getInstance();
// get params
$params =& $mainframe->getParams();
// init vars
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$date =& JFactory::getDate();
$pathway =& $mainframe->getPathway();
$template = $mainframe->getTemplate();
$option = JRequest::getCmd('option');
$controller = JRequest::getWord('controller');
$catalog_id = 0;
$category_id = (int) JRequest::getInt('category_id', 0);
// if category_id is set, generate pathway
if ($category_id) {
// parse catalog/category
$catalog_category = $params->get('catalog_category', '0:0');
if (strpos($catalog_category, ':')) {
list($catalog_id, $params_category_id) = explode(':', $catalog_category, 2);
}
// if category set, get categories from model data
$categories =& $this->get('categories');
// raise warning when category can not be accessed
if (!isset($categories[$category_id])) {
JError::raiseWarning(500, JText::_('Unable to access category'));
return;
}
// create pathway
$addpath = false;
foreach ($categories[$category_id]->getPathway() as $cat) {
if (!$params_category_id || $addpath) {
$link = JRoute::_('index.php?Itemid='.$Itemid.'&option='.$option.'&view=category&category_id='.$cat->id);
$pathway->addItem($cat->getName(), $link);
}
if ($params_category_id && $params_category_id == $cat->id) {
$addpath = true;
}
}
}
// get item from model data
$item =& $this->get('item');
// fire trigger
$dispatcher->trigger('onPrepareDisplayItem', array(&$this, &$item));
// raise warning when item can not be accessed
if (empty($item->id) || !$item->canAccess($user)) {
JError::raiseError(500, JText::_('Unable to access item'));
return;
}
// raise warning when item is not published
$publish_up =& JFactory::getDate($item->publish_up);
$publish_down =& JFactory::getDate($item->publish_down);
if ($item->state != 1 || !(
($item->publish_up == $db->getNullDate() || $publish_up->toUnix() <= $date->toUnix()) &&
($item->publish_down == $db->getNullDate() || $publish_down->toUnix() >= $date->toUnix()))) {
JError::raiseError(404, JText::_('Item not published'));
return;
}
// create item pathway
$link = JRoute::_('index.php?Itemid='.$Itemid.'&option='.$option.'&view=item'.($category_id ? '&category_id='.$category_id : '').'&item_id='.$item->id);
$pathway->addItem($item->name, $link);
// update hit count
$item->hit();
// get page title, if exists
$title = $item->name;
$menus = &JSite::getMenu();
$menu = $menus->getActive();
if ($menu) {
$menu_params = new JParameter($menu->params);
if ($menu_params->get('page_title')) {
$title = $menu_params->get('page_title');
}
}
// set metadata
$document->setTitle($title);
if ($item->metadesc) $document->setDescription($item->metadesc);
if ($item->metakey) $document->setMetadata('keywords', $item->metakey);
if ($mainframe->getCfg('MetaTitle')) $document->setMetadata('title', $item->name);
if ($mainframe->getCfg('MetaAuthor')) $document->setMetadata('author', $item->author);
$metadata = new JParameter($item->metadata);
foreach ($metadata->toArray() as $tag => $value) {
if ($value) $document->setMetadata($tag, $value);
}
// set default layout
$this->setLayout('item');
// set layout override, if exists
$type = $item->getType();
$path_default = JPATH_BASE."/templates/$template/html/$option/".$this->getName();
$path_template = $params->get('template') ? ZOO_SITE_PATH.'/templates/'.$params->get('template') : null;
$layout_type = $type->alias;
$layout_item = "item_".$item->id;
if (JPath::find($path_default, $layout_item.'.php')) {
$this->setLayout($layout_item);
} else if (JPath::find($path_default, $layout_type.'.php')) {
$this->setLayout($layout_type);
} else if ($path_template && JPath::find($path_template, 'item.php')) {
$this->addTemplatePath($path_template);
}
// set template vars
$this->assignRef('option', $option);
$this->assignRef('catalog_id', $catalog_id);
$this->assignRef('category_id', $category_id);
$this->assignRef('item', $item);
$this->assign('link_base', 'index.php?Itemid='.$Itemid.'&option='.$option);
// fire trigger
$dispatcher->trigger('onBeforeDisplayItem', array(&$this));
// call parent display
parent::display($tpl);
// fire trigger
$dispatcher->trigger('onAfterDisplayItem', array(&$this));
}
}
?>
Thanks to these posts for pointing me in the right direction.
http://forum.joomla.org/viewtopic.php?f ... 79&start=0
http://forum.joomla.org/viewtopic.php?f ... 93&start=0