Phoca Gallery on Joomla 3.X not shows ALT Text for thumbnails with a particular configuration, how to fix it.

All Joomla developers know Phoca Gallery written by Jan Pavelka: a very powerful, beautiful and flexible Photo Gallery Extension for our Websites.
This is not the best place to say how many nice features has Phoca Gallery, please follow the link above to discover all about this Masterpiece.

What I like to analyse hier is a small issue that I had with a particular Global Configuration of the extension and only in Category View (tested on PhG ver. 4.3.0 and 4.3.4).
Usually I use Phoca Gallery for my projects with the same configuration, but I noticed that all Category Views have no Alternative Text by each Thumbnails. This is not the best for the SEO and Page quality. I've checked why this happen and I found a conditional that blocked ALT Text rendering if some parameters are set (conflict with Shadowbox).
I've seen also that the Class $cv (this contains all images data) is not empty. However $cv->altvalue is not rendered before.
So I simply changed which elements from this Class I have to call and get an Alternative Text.
Therefore, I extract a known value instead of another that is not provided under certain conditions.

For my needs I call and render the Image Title: $cv->title.

As usual, prepare the override in your template folder. Copy the file:

components -> com_phocagallery -> views -> category -> tmpl -> default_images.php

and paste in:

| html
-| com_phocagallery
--| category
---| default_images.php

Now you have to find where the ALT Text is rendered.
Find out this PHP comment: // IMG Start and try to change this:

echo JHtml::_( 'image', $cv->linkthumbnailpath, $cv->altvalue, $cv->ooverlibclass);

into this:

echo JHtml::_( 'image', $cv->linkthumbnailpath, $cv->title, $cv->ooverlibclass);

NOTE: I can't know how your Phoca Gallery or how your parameters are set, but if you get no ALT Text probably you are in the right place to fix it.

I've seen that Jan has written a notice in his PHP file, exactly where $cv->altvalue is prepared. Effectively, if I try to change something over there, I get no Image Title on Shadowbox Detail Window. But with my small hack in default_images.php everything works fine and I have Alternative Text (I mean Image Titles as ALT Text) everywhere on Category View.

Thanks, Fabrizio.


  • |
  • |
  • Modified: not yet modified