Phocagallery plugin pagination - WORKING

Phoca Gallery plugins - plugins for Phoca Gallery extension
gravex
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 10 Oct 2020, 20:17

Phocagallery plugin pagination - WORKING

Post by gravex »

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

Code: Select all

$cssSbox		= '';
add:

Code: Select all

$counter=0;
Here we set our pagination counter to 0

4. Around line 159 just after

Code: Select all

$padding_box = $paramsC->get( 'padding_box', 5);
add:

Code: Select all

$pagination	= $paramsC->get( 'pagination', 0);
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

Code: Select all

else if($values[0]=='hsclosebutton')	{$highslide_close_button	= $values[1];}
add:

Code: Select all

else if($values[0]=='pagination')		{$pagination	= $values[1];}
We get page break number from our article.

6. Around line 765 just after

Code: Select all

foreach ($category as $image) {
add:

Code: Select all

if ($pagination > 0) {								
if($counter == $pagination) {
$output .= '<hr class="system-pagebreak" />';
$counter = 0;					
}
$counter++;
}
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:

Code: Select all

{phocagallery view=category|categoryid=2|pagination=30}
If you omit pagination attribute then pagination will not show up. Simple as that.

Enjoy and have fun.

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phocagallery plugin pagination - WORKING

Post by Jan »

Hi, thank you very much for your ideas and improvements.

Jan
If you find Phoca extensions useful, please support the project
gravex
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 10 Oct 2020, 20:17

Re: Phocagallery plugin pagination - WORKING

Post by gravex »

You welcome Jan.
The only drawback I found so far is that last page is not inside article container.
Maybe putting pagination counter in some other place of the code would have solve that issue.
If anyone was able to figure that out please post it here.
Post Reply