Searching...
Saturday, January 4, 2014

How to integrate pdf icon in joomla 3.0


In Joomla! 2.5 or 3.x the PDF icon is not more available. In this blog you will get step by step process to integrate it on your joomla 3.x.

Step1:-  a). At first you download Phoca PDF component zip file  here.
            b). Also you download Phoca pdf content plugin zip from here.

Step2:- Go to your site administrator and open extension manager and install these two zip files one by one.

Step3:- Activate the installed Phoca PDF system plugin from plugin manager. It is a system plugin.

Step4:- Now you need to edit files of your joomla content component.

## First one is components/com_content/views/article/tmpl/default.php

Change it 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; ?>
<?php
</ul>
</div>
<?php endif; ?>

Change it 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; ?>


## Second is components/com_content/views/category/tmpl/blog_item.php
Change it 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; ?>

Change it 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; ?>

Now go to the site administrator and enable the print icons param from menu and/or articles. Then you will get pdf icon on frontend of your site.

Note:-  You should aware, some of templates override the component files, that means, file which are displaying content are not in component's com_content folder but it displaying content from html folder inside you template folder. If it occurs then you should do these changes in com_content inside template's html folder and not in component folder.

0 comments:

Post a Comment

 
Back to top!