Page 1 of 1
Latest categories module
Posted: 18 May 2016, 16:52
by wolvyreen
Hi,
I want to display the last 5 categories added to the gallery in a module on the home page but I can't work out how to insert this. i have installed the content plugin and the button and they are both enabled but it doesn't seem to have the option to show the last 5 categories or an option to set how many latest categories i want to show.
Also, when adding the code inside the custom html module, it just shows the code and not the phoca view.
any ideas??
Thanks
Wolvy
Re: Latest categories module
Posted: 18 May 2016, 17:38
by Benno
Hi,
Also, when adding the code inside the custom html module, it just shows the code and not the phoca view.
Did you set
Prepare Content=Yes in the Options of the Custom Module?
Kind regards,
Benno
Re: Latest categories module
Posted: 18 May 2016, 18:00
by wolvyreen
Benno wrote:Hi,
Also, when adding the code inside the custom html module, it just shows the code and not the phoca view.
Did you set
Prepare Content=Yes in the Options of the Custom Module?
Kind regards,
Benno
Thanks benno

This sorted my displaying issue out but now i noticed that it is showing the categories in a vertical list instead of a horizontal list. sigh....how do I change it to look like the normal categories view on the phoca gallery?? and how do I only show the latest 5 categories??
Re: Latest categories module
Posted: 19 May 2016, 10:04
by wolvyreen
So I was forced to bastardise the plugin code to get it working the way I wanted it to. Also, it seems that the plugin is very obsolete. It just dumps the categories in to a table layout with each category listed underneath one another. This is TERRIBLE for a responsive layout as well as terrible in generally for a layout. tables should not be used for this sort of plugin. Anyway, for those interested, this is what I changed in order to show the 5 latest categories. i am very aware that this is hard coded but I wasn't about to code an entirely new plugin just for the 5 latest categories.
Make a backup of the following file: /plugins/content/phocagallery/phocagallery.php and then proceed to edit it
Find this line inside the file. It should not be difficult to find as there are only two places with the table element and only one with the below line of code.
right underneath this line, add the following code:
Code: Select all
$maxCategories == 5;
$catCount == 0;
then underneath the foreach line after the curly brace which is directly below the table element mentioned above, add this line of code:
Then search for this line of code
Code: Select all
.'<a href="'.$category->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$category->title.'</a></div>';
right underneath it and before the curly braces, add this code:
The end result should look like this:
$small_image_height = $small_image_height +18;
echo "output = ".$output;
$output .= '<table border="0">';
$maxCategories == 5;
$catCount == 0;
foreach ($data_outcome_array as $category) {
$catCount = $catCount+1;
// ROUTE
$category->link = JRoute::_(PhocaGalleryRoute::getCategoryRoute($category->id, $category->alias));
...
} else {
$output .='<img class="pg-image" src="'.JURI::base(true).'/'.$category->linkthumbnailpath.'" alt="'.$category->title.'" style="border:0" />';
}
$output .='</a></td>'
.'<td><a href="'.$category->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$category->title.'</a> '
.'<span class="small">('.$category->numlinks.')</span></td>'
.'</tr>';
if ($catCount == 5) { break; }
}
$output .= '</table>';
Re: Latest categories module
Posted: 21 May 2016, 15:58
by Jan
Hi, thank you very much for the guide. Yes, some parts can be very obsolete. The main preference is always the component (to be ready for the newest Joomla! versions, to be ready for new coding and styling techniques like responsive design is).
I will take a look at the modifications and will try to update the plugin for the next version.
And yes of course, we are in open source world, if there is somebody who wants to help the project and will update the plugin for newest features, will be great.
Thank you very much.
Jan