Disable next / prev for single images

Phoca Gallery plugins - plugins for Phoca Gallery extension
HerrPixel
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 27 Aug 2016, 19:03

Disable next / prev for single images

Post by HerrPixel »

I was wondering if there is a way to disable the next & previous buttons when inserting only single images into the article

When i do something like this:

Code: Select all

some text
{phocagallery view=category|categoryid=4|imageid=32}

more text
{phocagallery view=category|categoryid=4|imageid=33}
I don't want the user to cycle through all the images. I want only to enlarge the one single image.

A related issue (bonus question):
when i insert multiple category-galleries the cycling should happen only inside the given category. right now i can cycle through all images on the page :/

Code: Select all

Text
{phocagallery view=category|categoryid=1|limitstart=0|limitcount=0}
more text
{phocagallery view=category|categoryid=2|limitstart=0|limitcount=0}
I am using Phoca Gallery Component ver. 4.3.1, Phoca Gallery Plugin 4.3.1 and the editor-button 4.2.1.
The Detail-View is set to boxplus(image only) with the shadowbox inspired theme.

Is there a way to enter some shortcodes to disable / control the grouping of the images (like the rel-parameter in the old lightbox).
Maybe there's a way to override it in php?

Any help really appreciated.
HerrPixel
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 27 Aug 2016, 19:03

Re: Disable next / prev for single images

Post by HerrPixel »

Ok, I have a very dirty fix using the boxplus autodiscover method.

First in plugins/content/phocagallery/phocagallery.php in the if/else block for the detail window (line ~1457) i created an additional "else if"
to give each gallery an unique rel-parameter

Code: Select all

} else if ($tmpl['detail_window'] == 10) {
    $output .=' rel="boxplus-'.$randName.'" ';
}
Then in administrator/components/com_phocagallery/libraries/phocagallery/render/renderdetailwindow.php (line ~370) i commented out the entire content of the if-block (which is strange btw, because it creates a new instance of boxplus for every image – is it intended?)

Code: Select all

/*
                // Image
                $document->addScriptDeclaration('new boxplus($$("a.phocagallerycboxplus'.$this->extension.'"),{"theme":"'.$this->bpTheme.'","autocenter":'.(int)$this->bpBautocenter.',"autofit":'.(int)$this->bpAutofit.',"slideshow":'.(int)$this->bpSlideshow.',"loop":'.(int)$this->bpLoop.',"captions":"'.$this->bpCaptions.'","thumbs":"'.$this->bpThumbs.'","width":'.(int)$this->popupWidth.',"height":'.(int)$this->popupHeight.',"duration":'.(int)$this->bpDuration.',"transition":"'.$this->bpTransition.'","contextmenu":'.(int)$this->bpContextmenu.', phocamethod:1});');


                // Icon
                $document->addScriptDeclaration('new boxplus($$("a.phocagallerycboxplusi'.$this->extension.'"),{"theme":"'.$this->bpTheme.'","autocenter":'.(int)$this->bpBautocenter.',"autofit":'.(int)$this->bpAutofit.',"slideshow":'.(int)$this->bpSlideshow.',"loop":'.(int)$this->bpLoop.',"captions":"'.$this->bpCaptions.'","thumbs":"hide","width":'.(int)$this->popupWidth.',"height":'.(int)$this->popupHeight.',"duration":'.(int)$this->bpDuration.',"transition":"'.$this->bpTransition.'","contextmenu":'.(int)$this->bpContextmenu.', phocamethod:1});');
                
*/
Finally i placed the autodiscover code in the javascript file of my template (or the index.php)

Code: Select all

<script>
boxplus.autodiscover(true,{"theme":"shadow", "autocenter":true, "autofit":true, "slideshow":0, "loop":false, "captions":"bottom", "thumbs":"none", "width":800, "height":600, "duration":250, "transition":"sine", "protection":false});
</script>

Obviously this solutions has some serious drawbacks:
#1 the settings for boxplus are hardcoded and you cannot adjust them in the joomla-backend
#2 the changes on the phocagallery.php and renderdetailwindow.php files will be most probably overwritten with every phocagallery update
#3 the boxplus code will be loaded on every page – even if you don't need it – throwing errors in the console

So I am still hoping to find a more elegant solution.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Disable next / prev for single images

Post by Jan »

Hi, yes, unfortunately, the plugin is a little bit complicated as component. Plugin can be displayed on site only one time but it can be displayed more times (in blog, when using in module, etc.). And even in one article, there can be more instances of the plugin. Some javascript libraries allows to differentiate between more instances in site, some not. And even, by one image you can have two instances of the button - on over the image, second over the icon below image - and such needs to be differentiaded too.

So the process is following.

Phoca Gallery tries to load the libraries only one time - to not make duplicities (but sometimes it cannot work as it does not have information from other parts of the system) and because of this loading, all images on the sites become one instance (in some methods)

For now I don't understand, if the boxplus is loaded one time or more time when the changes are done, or as default?

As I wrote sometimes, because all is done systematic and you cannot predict how many times the plugin instance will be displayed on the site, in some cases it is possible that some library will be loded more times even this is not the right behaviour we want :-( But this is standard problem of systems which are build from any different parts :idea:

Jan
If you find Phoca extensions useful, please support the project
Post Reply