Phocagallery plugin pagination - WORKING
Posted: 10 Oct 2020, 20:38
Hi everyone,
Like many others on this forum I also wanted to have pagination in Phocagallery plugin.
So I started digging around and finally made a working patch.
Joomla has system article pagination so why not using it for our plugin?
My pagination works like:
{phocagallery view=category|categoryid=2|pagination=30}
It is very simple and I wonder why it wasn't implemented yet.
Follow these instructions in order to make it work.
1. Enable Content - Page Break in Joomla>Extensions>Plugins.
I recommend disabling Article Index Heading and Table of Contents in Plugin settings in order not to break your layout design.
2. Edit /plugins/content/phocagallery/phocagallery.php
3. Around line 105 just after add:
Here we set our pagination counter to 0
4. Around line 159 just after add:
We set default value to 0 so if we don't set pagination value pagination will be off by default.
5. Around line 270 just after add:
We get page break number from our article.
6. Around line 765 just after add:
Here we count values and set our pagination.
That's it. You are ready to go and use default Joomla pagination for Phocagallery plugin inside article.
You just need to set pagination value in your article like this:
If you omit pagination attribute then pagination will not show up. Simple as that.
Enjoy and have fun.
Like many others on this forum I also wanted to have pagination in Phocagallery plugin.
So I started digging around and finally made a working patch.
Joomla has system article pagination so why not using it for our plugin?
My pagination works like:
{phocagallery view=category|categoryid=2|pagination=30}
It is very simple and I wonder why it wasn't implemented yet.
Follow these instructions in order to make it work.
1. Enable Content - Page Break in Joomla>Extensions>Plugins.
I recommend disabling Article Index Heading and Table of Contents in Plugin settings in order not to break your layout design.
2. Edit /plugins/content/phocagallery/phocagallery.php
3. Around line 105 just after
Code: Select all
$cssSbox = '';
Code: Select all
$counter=0;
4. Around line 159 just after
Code: Select all
$padding_box = $paramsC->get( 'padding_box', 5);
Code: Select all
$pagination = $paramsC->get( 'pagination', 0);
5. Around line 270 just after
Code: Select all
else if($values[0]=='hsclosebutton') {$highslide_close_button = $values[1];}
Code: Select all
else if($values[0]=='pagination') {$pagination = $values[1];}
6. Around line 765 just after
Code: Select all
foreach ($category as $image) {
Code: Select all
if ($pagination > 0) {
if($counter == $pagination) {
$output .= '<hr class="system-pagebreak" />';
$counter = 0;
}
$counter++;
}
That's it. You are ready to go and use default Joomla pagination for Phocagallery plugin inside article.
You just need to set pagination value in your article like this:
Code: Select all
{phocagallery view=category|categoryid=2|pagination=30}
Enjoy and have fun.