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
Latest categories module
- Benno
- Phoca Hero

- Posts: 9965
- Joined: 04 Dec 2008, 11:58
- Location: Germany
- Contact:
Re: Latest categories module
Hi,
Kind regards,
Benno
Did you set Prepare Content=Yes in the Options of the Custom Module?Also, when adding the code inside the custom html module, it just shows the code and not the phoca view.
Kind regards,
Benno
-
wolvyreen
- Phoca Member

- Posts: 13
- Joined: 18 May 2016, 14:41
Re: Latest categories module
Thanks bennoBenno wrote:Hi,Did you set Prepare Content=Yes in the Options of the Custom Module?Also, when adding the code inside the custom html module, it just shows the code and not the phoca view.
Kind regards,
Benno
-
wolvyreen
- Phoca Member

- Posts: 13
- Joined: 18 May 2016, 14:41
Re: Latest categories module
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:
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
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>';
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.
Code: Select all
$output .= '<table border="0">';Code: Select all
$maxCategories == 5;
$catCount == 0;Code: Select all
$catCount = $catCount+1;Code: Select all
.'<a href="'.$category->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$category->title.'</a></div>';Code: Select all
if ($catCount == 5) { break; }$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>';
- Jan
- Phoca Hero

- Posts: 49144
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Latest categories module
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
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
If you find Phoca extensions useful, please support the project