bjornkock wrote:I had the same issues. Took me a while, but I got it to work with the following custom edits to Gantry.
worked for me. I hope it works for you, too.
Hi,
I followed the instructions and now I am getting two print icons with the 2nd one which does PDF but looks like a printer, how do I convert the second icon to PDF?
My phocapdf.php is:
Code: Select all
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocapdf'.DS.'helpers'.DS.'phocapdfbrowser.php');
defined('_JEXEC') or die();
class PhocaPDFHelper
{
/*
* components/com_content/helpers/icon.php
*/
public function getPhocaPDFContentIcon($item, $params, $attribs = array()) {
$lang = JFactory::getLanguage();
$lang->load('plg_phocapdf_content', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false);
// Plugin Parameters
jimport( 'joomla.html.parameter' );
//$pluginP = new JParameter( $plugin->params );
$plugin = JPluginHelper::getPlugin('phocapdf', 'content');
$pluginP = new JRegistry();
$pluginP->loadJSON($plugin->params);
$exclude_articles = $pluginP->get('exclude_articles', '');
$exclude_categories = $pluginP->get('exclude_categories', '');
$exclude_articles = explode(',', $exclude_articles );
$exclude_categories = explode(',', $exclude_categories );
if(isset($item->catid) && in_array($item->catid, $exclude_categories)) {
return "";
}
if(isset($item->id) && in_array($item->id, $exclude_articles)) {
return "";
}
$pdfDest = $pluginP->get('pdf_destination', 'S');
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,'
.'resizable=yes,width=640,height=480,directories=no,location=no';
if ($pdfDest == 'I' || $pdfDest == 'D') {
$attribs['onclick'] = '';
} else {
$browser = PhocaPDFHelperBrowser::browserDetection('browser');
if ($browser == 'msie7' || $browser == 'msie8') {
$attribs['onclick'] = '';
$attribs['target'] = '_blank';
} else {
$attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";
}
}
$url = ContentHelperRoute::getArticleRoute($item->slug, $item->catid);
$url .= '&tmpl=component&format=pdf';//&page='.@ $request->limitstart;
// checks template image directory for image, if non found default are loaded
if ($params->get('show_icons')) {
$text = JHTML::_('image','components/com_phocapdf/assets/images/pdf_button.png', JText::_('PLG_PHOCAPDF_CONTENT_PDF'));
} else {
if ($params->get('show_print_icon')) {
//$sep = JText::_('JGLOBAL_ICON_SEP');
$sep = '';
} else if ($params->get('show_email_icon')) {
$sep = JText::_('JGLOBAL_ICON_SEP');
} else {
$sep = '';
}
$text = ' '. JText::_('PLG_PHOCAPDF_CONTENT_PDF') .' '. $sep;
}
$attribs['title'] = JText::_('PLG_PHOCAPDF_CONTENT_PDF');
$attribs['rel'] = 'nofollow';
$output = '<li class="pdf-icon">'
. JHTML::_('link',JRoute::_($url), $text, $attribs)
.'</li>';
return $output;
}
function renderFTPaccess() {
$ftpOutput = '<fieldset title="'.JText::_('COM_PHOCAPDF_FTP_LOGIN_LABEL'). '">'
.'<legend>'. JText::_('COM_PHOCAPDF_FTP_LOGIN_LABEL').'</legend>'
.JText::_('COM_PHOCAPDF_FTP_LOGIN_DESC')
.'<table class="adminform nospace">'
.'<tr>'
.'<td width="120"><label for="username">'. JText::_('JGLOBAL_USERNAME').':</label></td>'
.'<td><input type="text" id="username" name="username" class="input_box" size="70" value="" /></td>'
.'</tr>'
.'<tr>'
.'<td width="120"><label for="password">'. JText::_('JGLOBAL_PASSWORD').':</label></td>'
.'<td><input type="password" id="password" name="password" class="input_box" size="70" value="" /></td>'
.'</tr></table></fieldset>';
return $ftpOutput;
}
function getPhocaInfo($pdf = 1) {
$params = JComponentHelper::getParams('com_phocapdf') ;
$pdf = $params->get( 'pdf_id', 1);
if ($pdf == 1) {
return '<'.'a'.' '.'s'.'t'.'y'.'l'.'e'.'='.'"'.'c'.'o'.'l'.'o'.'r'.':'.' '.'r'.'g'.'b'.'('.'1'.'7'.'5'.','.'1'.'7'.'5'.','.'1'.'7'.'5'.')'.'"'.' '.'h'.'r'.'e'.'f'.'='.'"'.'h'.'t'.'t'.'p'.':'.'/'.'/'.'w'.'w'.'w'.'.'.'p'.'h'.'o'.'c'.'a'.'.'.'c'.'z'.'/'.'p'.'h'.'o'.'c'.'a'.'p'.'d'.'f'.'"'.'>'.'P'.'h'.'o'.'c'.'a'.' '.'P'.'D'.'F'.'<'.'/'.'a'.'>';
} else {
return '';
}
}
function getPhocaVersion($component) {
$folder = JPATH_ADMINISTRATOR .DS. 'components'.DS.$component;
if (JFolder::exists($folder)) {
$xmlFilesInDir = JFolder::files($folder, '.xml$');
} else {
$folder = JPATH_SITE .DS. 'components'.DS.$component;
if (JFolder::exists($folder)) {
$xmlFilesInDir = JFolder::files($folder, '.xml$');
} else {
$xmlFilesInDir = null;
}
}
$xml_items = '';
if (count($xmlFilesInDir))
{
foreach ($xmlFilesInDir as $xmlfile)
{
if ($data = JApplicationHelper::parseXMLInstallFile($folder.DS.$xmlfile)) {
foreach($data as $key => $value) {
$xml_items[$key] = $value;
}
}
}
}
if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
return $xml_items['version'];
} else {
return '';
}
}
}
class PhocaPDFCell
{
function setCell($pdf = 1) {
$params = JComponentHelper::getParams('com_phocapdf') ;
$pdf = $params->get( 'pdf_id', 1);
if ($pdf == 1) {
return '<'.'a'.' '.'s'.'t'.'y'.'l'.'e'.'='.'"'.'c'.'o'.'l'.'o'.'r'.':'.' '.'r'.'g'.'b'.'('.'1'.'7'.'5'.','.'1'.'7'.'5'.','.'1'.'7'.'5'.')'.'"'.' '.'h'.'r'.'e'.'f'.'='.'"'.'h'.'t'.'t'.'p'.':'.'/'.'/'.'w'.'w'.'w'.'.'.'p'.'h'.'o'.'c'.'a'.'.'.'c'.'z'.'/'.'p'.'h'.'o'.'c'.'a'.'p'.'d'.'f'.'"'.'>'.'P'.'h'.'o'.'c'.'a'.' '.'P'.'D'.'F'.'<'.'/'.'a'.'>';
} else {
return '';
}
}
}
class PhocaPDFControlPanel
{
function quickIconButton( $component, $link, $image, $text ) {
$lang = &JFactory::getLanguage();
$button = '';
if ($lang->isRTL()) {
$button .= '<div class="icon-wrapper">';
} else {
$button .= '<div class="icon-wrapper">';
}
$button .= '<div class="icon">'
.'<a href="'.$link.'">'
.JHTML::_('image.site', $image, '/components/'.$component.'/assets/images/', NULL, NULL, $text )
.'<span>'.$text.'</span></a>'
.'</div>';
$button .= '</div>';
return $button;
}
}
?>
My settings are
Code: Select all
<?php
/**
* @package Template Overrides - RocketTheme
* @version 1.6.2 June 22, 2011
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2011 RocketTheme, LLC
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*
* Rockettheme Gantry Template uses the Joomla Framework (http://www.joomla.org), a GNU/GPLv2 content management system
*
*/
// no direct access
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers');
// Create shortcuts to some parameters.
$params = $this->item->params;
$canEdit = $this->item->params->get('access-edit');
$user = JFactory::getUser();
?>
<div class="rt-article">
<div class="item-page">
<?php /** Begin Page Title **/ if ($this->params->get('show_page_heading', 1)) : ?>
<h1 class="rt-pagetitle">
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php /** End Page Title **/ endif; ?>
<div class="article-header">
<?php /** Begin Article Title **/ if ($params->get('show_title')) : ?>
<div class="module-title"><div class="module-title2"><div class="module-title3">
<h2 class="title">
<?php if ($params->get('link_titles') && !empty($this->item->readmore_link)) : ?>
<a href="<?php echo $this->item->readmore_link; ?>">
<?php echo $this->escape($this->item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</h2>
</div></div></div>
<?php /** End Article Title **/ endif; ?>
<div class="clear"></div>
<?php $useDefList = (($params->get('show_author')) OR ($params->get('show_create_date')) OR ($params->get('show_modify_date')) OR ($params->get('show_publish_date'))
OR ($params->get('show_hits')) || ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon'))); ?>
<?php /** Begin Article Info **/ if ($useDefList) : ?>
<div class="rt-articleinfo">
<div class="rt-articleinfo-text"><div class="rt-articleinfo-text2">
<?php if ($params->get('show_create_date')) : ?>
<div class="rt-date-posted">
<?php echo JHtml::_('date',$this->item->created, JText::_('DATE_FORMAT_LC3')); ?>
</div>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<div class="rt-date-modified">
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date',$this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</div>
<?php endif; ?>
<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
<div class="rt-author">
<?php $author = $this->item->author; ?>
<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>
<?php if (!empty($this->item->contactid ) && $params->get('link_author') == true):?>
<?php echo JHtml::_('link',JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid),$author); ?>
<?php else :?>
<?php echo $author; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<div class="rt-date-published">
<?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE', JHtml::_('date',$this->item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</div>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<div class="rt-hits">
<?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
</div>
<?php endif; ?>
</div></div>
<?php
$phocaPDF = false;
if (JPluginHelper::isEnabled('phocapdf', 'content')) {
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_phocapdf'
.DS.'helpers'.DS.'phocapdf.php');
$phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item,
$params);
}
?>
<?php /** Begin Article Icons **/ if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon') || $phocaPDF) : ?>
<div class="rt-article-icons">
<ul class="actions">
<?php echo $phocaPDF; ?>
<?php if (!$this->print) : ?>
<?php if ($params->get('show_print_icon')) : ?>
<li class="print-icon">
<?php echo JHtml::_('icon.print_popup', $this->item, $params); ?>
</li>
<?php endif; ?>
<?php if ($params->get('show_email_icon')) : ?>
<li class="email-icon">
<?php echo JHtml::_('icon.email', $this->item, $params); ?>
</li>
<?php endif; ?>
<?php if ($canEdit) : ?>
<li class="edit-icon">
<?php echo JHtml::_('icon.edit', $this->item, $params); ?>
</li>
<?php endif; ?>
<?php else : ?>
<li>
<?php echo JHtml::_('icon.print_screen', $this->item, $params); ?>
</li>
<?php endif; ?>
</ul>
</div>
<?php /** End Article Icons **/ endif; ?>
<div class="clear"></div>
</div>
<?php endif; ?>
</div>
<?php if (!$params->get('show_intro')) :
echo $this->item->event->afterDisplayTitle;
endif; ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<?php if (isset ($this->item->toc)) : ?>
<?php echo $this->item->toc; ?>
<?php endif; ?>
<?php if ($params->get('access-view')):?>
<?php echo $this->item->text; ?>
<?php //optional teaser intro text for guests ?>
<?php elseif ($params->get('show_noauth') == true AND $user->get('guest') ) : ?>
<?php echo $this->item->introtext; ?>
<?php //Optional link to let them register to see the whole article. ?>
<?php if ($params->get('show_readmore') && $this->item->fulltext != null) :
$link1 = JRoute::_('index.php?option=com_users&view=login');
$link = new JURI($link1);?>
<p class="readmore">
<a href="<?php echo $link; ?>">
<?php $attribs = json_decode($this->item->attribs); ?>
<?php
if ($attribs->alternative_readmore == null) :
echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
elseif ($readmore = $this->item->alternative_readmore) :
echo $readmore;
if ($params->get('show_readmore_title', 0) != 0) :
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif;
elseif ($params->get('show_readmore_title', 0) == 0) :
echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
else :
echo JText::_('COM_CONTENT_READ_MORE');
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif; ?></a>
</p>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayContent; ?>
<?php if ($params->get('show_parent_category') && $this->item->parent_slug != '1:root') : ?>
<div class="rt-parent-category">
<?php $title = $this->escape($this->item->parent_title);
$url = '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->parent_slug)).'">'.$title.'</a>';?>
<?php if ($params->get('link_parent_category') AND $this->item->parent_slug) : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<div class="rt-category">
<?php $title = $this->escape($this->item->category_title);
$url = '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug)).'">'.$title.'</a>';?>
<?php if ($params->get('link_category') AND $this->item->catslug) : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>