Phoca

Phoca

Phoca PDF Installation and Usage - Joomla! 3

 
This article describes how to install Phoca PDF component in Joomla! 3.0 - 3.2
If you are using Joomla! 3.3 or any later version, see this guide:
Phoca PDF Installation and Usage - Joomla! 3.3

 

In Joomla! 2.5 or 3.x the PDF feature is not more available. If you want to create PDF documents from your articles, you should install Phoca PDF component and Phoca PDF Content plugin. However, it's not as easy as it looks. Joomla! core does not include links to PDF in article views and there is no efficient event which allows you to insert PDF link through some plugin. It means, some of core Joomla! content files needs to be edited.

 

Download

Download Phoca PDF component from the Phoca PDF download site. You get a ZIP file.

Install

Login into your Joomla! administration site and follow these steps:

Go to Extension Manager (Extensions - Extension Manager - Install). You can:

  • Upload Package File - select the Phoca PDF component ZIP file from your disc and click onUpload File & Install.
  • Install from Directory - you can upload Phoca PDF component ZIP file into your server directory and install it from this directory
  • Install from URL - you can install it from another URL.


1) Install the component.

 

2) Component itself does not produce PDFs, so for creating PDF document from article, you need to install Phoca PDF content plugin. Install it the same way like you have installed the component. After installation, go to Plugin Manager and enable this plugin so it will be active.

 

3) We have installed Phoca PDF component and Phoca PDF content plugin. Now Joomla! can produce PDF documents from articles. But we need one more little thing - a link to PDF. Unfortunately, articles are a part of Joomla! core and it does not include such links, so we need to create them, there are two options which are possible to do:

 

3a) Installing Phoca PDF system plugin (be aware Phoca PDF system plugin is not Phoca PDF content plugin). Phoca PDF system plugin tries to find a place where Joomla! places all other icons (Print, Email) and then it tries to add the PDF icon (PDF link) there. Such feature has a lot limitations:

  • It works only with standard templates which does not override Joomla! output
  • It can affect other parts of Joomla! output (e.g. remove some other parts of html code from the output)
  • It works only in Article view (not in Featured or Category view)

What is the advantage of such solution? In case you want to display PDF icon only in article view and your template output has standard format, then you don't need to modify the content files (see below) every time you will upgrade your Joomla!.

 

3b) Using system plugin will not work on most sites, so the only one solution is to modify the content files (and of course they should be modified after every Joomla! update) :-(

 

Customizing Joomla! core content files:

 

Edit the following file (if your template overrides Joomla! content files, you need to edit this file in your template's folder):

components/com_content/views/article/tmpl/default.php

line cca 52

 

FROM:

<?php if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
    <div class="btn-group pull-right">
    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <span class="icon-cog"></span> <span class="caret"></span> </a>
    <?php // Note the actions class is deprecated. Use dropdown-menu instead. ?>
    <ul class="dropdown-menu actions">
    <?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; ?>
    </ul>
    </div>
    <?php endif; ?>

TO:

<?php $phocaPDF = false;
    if (JPluginHelper::isEnabled('phocapdf', 'content')) {
    include_once(JPATH_ADMINISTRATOR.'/components/com_phocapdf/helpers/phocapdf.php');
    $phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $params);
    } ?>
    <?php if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon') || $phocaPDF) : ?>
    <div class="btn-group pull-right">
    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <span class="icon-cog"></span> <span class="caret"></span> </a>
    <?php // Note the actions class is deprecated. Use dropdown-menu instead. ?>
    <ul class="dropdown-menu actions">
    <?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 echo $phocaPDF; ?>
    </ul>
    </div>
    <?php endif; ?>

 

Edit the following files (if your template overrides Joomla! content files, you need to edit these files in your template's folder):

components/com_content/views/category/tmpl/blog_item.php

components/com_content/views/featured/tmpl/default_item.php

line cca 38

 

FROM:

<?php if ($params->get('show_print_icon') || $params->get('show_email_icon') || $canEdit) : ?>
    <div class="btn-group pull-right"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" role="button"> <span class="icon-cog"></span> <span class="caret"></span> </a>
    <ul class="dropdown-menu">
    <?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; ?>
    </ul>
    </div>
    <?php endif; ?>

TO:

<?php $phocaPDF = false;
    if (JPluginHelper::isEnabled('phocapdf', 'content')) {
    include_once(JPATH_ADMINISTRATOR.'/components/com_phocapdf/helpers/phocapdf.php');
    $phocaPDF = PhocaPDFHelper::getPhocaPDFContentIcon($this->item, $params);
    } ?>
    <?php if ($params->get('show_print_icon') || $params->get('show_email_icon') || $canEdit || $phocaPDF) : ?>
    <div class="btn-group pull-right"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" role="button"> <span class="icon-cog"></span> <span class="caret"></span> </a>
    <ul class="dropdown-menu">
    <?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 echo $phocaPDF; ?>
    </ul>
    </div>
    <?php endif; ?>

 

Be aware, some of templates override content files, it means, the files to display content (article) are not used from com_content area but from template area. For example:

components/com_content/views/article/tmpl/default.php

is stored in:

templates/your-template/html/com_content/article/default.php

Then the template file needs to be overriden.

 

Using Joomla! cache system plugin

If Joomla! cache system plugin is enabled on your site, don't set PDF Destination parameter to value: Inline Browser in Phoca PDF Content Plugin parameters. Use Inline Browser (Popup) instead (which is default). Cache system plugin does not create correct cache file if Inline Browser parameter is set.

Phoca News Gadget

Phoca Facebook Phoca on Facebook:
Phoca Twitter Phoca on Twitter:
Phoca - Follow us on Twitter
Phoca Google Plus Phoca on Google+:
Phoca - Follow us on Google Plus
Phoca YouTube Phoca on YouTube:
Phoca on YouTube
Phoca Pinterest Phoca on Pinterest:
Phoca on Pinterest
Phoca News Phoca News:
Phoca News RSS
Phoca Latest Files Phoca Latest Files:
Phoca News RSS

Phoca Forum - Latest Topics