2

Joomla 3.3 and Gantry v4.1.26

Attached below (dropbox link) is an image that I mocked up in photoshop, I would like to add a toggle option to view a table column in the category list view that contains a link to a PDF (of my choice) from the root images folder.

https://www.dropbox.com/s/rtv0p4cq200rbs0/PDF-sidebar-concept.jpg?dl=0

I was following this tut:

https://ranawd.wordpress.com/2010/05/11/adding-custom-columnsfields-to-joomla-article/

which has lead me into many right directions but it is outdated and meant for Joomla 1.5. If there was something similar to this but updated for Joomla 3.3.

Many thanks in advance!

*UPDATE** - March 30/2015

I was able to add an extra row by adding the following in root/components/com_content/views/category/templ/default_articles.php :

<in the thread tags>

<?php if ($this->params->get('list_show_pdf')) : ?>
 <th id="categorylist_header_pdf">
  <?php echo JHtml::_('grid.sort', 'JGLOBAL_PDF', 'a.pdf', $listDirn, $listOrder); ?>
 </th>
<?php endif; ?>

<in the tbody tag>

<?php if ($this->params->get('list_show_pdf', 1)) : ?>
 <td headers="categorylist_header_hits" class="list-hits">
  <span class="badge badge-info">
   <?php echo JText::sprintf('JGLOBAL_PDF_LINK', $article->hits); ?>
  </span>
 </td>
<?php endif; ?>

All these are pretty much duplicates of the hit's function, i've also edited the language file to achieve 'JGLOBAL_PDF_LINK' and the default.xml file found in root/components/com_content/views/category/templ/default.xml adding:

<field name="list_show_pdf" type="list"
    description="JGLOBAL_ADD_PDF_DESC"
    label="JGLOBAL_ADD_PDF"
 >
    <option value="">JGLOBAL_USE_GLOBAL</option>
    <option value="0">JHIDE</option>
    <option value="1">JSHOW</option>
</field>

To achieve referencing "list_show_pdf".

We also have to add a toggle to the backend in article options, go to root/administrator/components/com_content/config.xml and add:

<field name="list_show_pdf"
    type="radio"
    class="btn-group btn-group-yesno"
    default="0"
    label="JGLOBAL_ADD_PDF"
    description="JGLOBAL_ADD_PDF_DESC">
        <option value="1">JSHOW</option>
        <option value="0">JHIDE</option>
</field>

I am still trying to store PDF files in the com_content table and show on the front end. Because in default_articles.php in the tbody code that I wrote it is out putting

$article->hits

Where I would like to output something like

$article->pdf

and have a link to a PDF from the root images folder. Any recommendations or help is greatly appreciated. I do want to write documentation for this so it is easier to follow.

Cheers!

4

0 回答 0