Link to multiple images using JAK

Phoca Gallery plugins - plugins for Phoca Gallery extension
candem
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 12 Oct 2009, 13:57

Link to multiple images using JAK

Post by candem »

First thanks for a great extension - I appreciate the work that has obviously gone into it.
I am trying to display a single image in an article and when that image is clicked on, have a group of images displayed in JAK with a vertical thumb strip.

I can get the single image to display and come up but can not seem to figure out how to get multiple images to come up.

These images are all in a sub-category.

Appreciate any help.

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

Re: Link to multiple images using JAK

Post by Jan »

Hi, there are two methods to display images in detail window - image and frame.

Some methods are image methods: Modal box (image only), Highslide JS (image only), Shadowbox, JAK - here you can only see images displayed on the site

some are iframe methods: Modal Box, Standard Popup, Highslide JS - here you can then display images from the category.

Jan
If you find Phoca extensions useful, please support the project
candem
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 12 Oct 2009, 13:57

Re: Link to multiple images using JAK

Post by candem »

Hi,
Thanks Jan.
These images are being displayed in an article.

If I put in an imageid it displays the one image - and when you click on that image it is the only one in the JAK popup.

If I remove the imageid it displays all the images in that category - when you click on one of these images the JAK popup has all the images and is exactly the way I want it!

The question is how do I get it to display just one image BUT have all the images when clicked on?

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

Re: Link to multiple images using JAK

Post by Jan »

Then you need to user iframe method, as the image method only can display images which are displayed on the site
If you find Phoca extensions useful, please support the project
candem
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 12 Oct 2009, 13:57

Re: Link to multiple images using JAK

Post by candem »

Thanks Jan.
I really like the JAK popup and the functionality was already there as it worked for showing a category.

I got it to work by modifying the phocagallery.php in the plugin. Here are the details in case it may help some one else.
I just added a:

Code: Select all

if ($iI < 1)  {  
at line 966 and then closed the loop around line 1248 (with a "}") to force it to only output one image in the HTML part.

Also had to add:

Code: Select all

$tmpl['jakdatajs'] = array(); 

to clear the sub array as if the first image had 4 images in the category and the second image had only 2 images - it still displayed 4 with the last 2 being from the first category.

Obviously this may screw up things if you are using one of the other popups, I was only concerned with JAK.

Thanks for all your work - Phoca Gallery is a great product!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48676
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Link to multiple images using JAK

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
dowal68
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 02 Feb 2010, 23:23

Re: Link to multiple images using JAK

Post by dowal68 »

Hi,

I am new on this forum and first thanks for this good extension.

I have the same problem as candem.

I show 2 categories (galleries) on a page. The first contains 12 images and the second 7.

When I click on a image the JAK popup works well, but the second JAK contains his 7 images and the 5 last images from the first.

It is necessary to clear some array.

I tried to insert "$tmpl['jakdatajs'] = array(); but I cannot find a good place.

I use pluging v2.6.2


Thanks in advance.
candem
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 12 Oct 2009, 13:57

Re: Link to multiple images using JAK

Post by candem »

I moved my site and had to redo this change and couldn't quite remember what I did so came back here to check.

Discovered that the notes I did were not complete so no surprise that people struggled. I redid the change so here is a more complete explanation.

First, the file to edit is the one in the plugin as that is what we are using - ../plugins/content/phocagallery.php
I am currently running 2.7.5 and these were the changes. I am pasting the code around the change so that you can figure it out if you are not using the same version as I am. Change around line 1077 - just the if statement is added

Code: Select all

					} else {
					
						$image->link 		= $siteLink;
						$image->link2 		= $siteLink;
						$image->linkother	= $siteLink;
						$image->linkorig	= $imgLinkOrig;
						
					}

					
// added to display only one image 
if ($iI < 1) {

					
					// Different types
The if loop then needs to be closed around line 1459 - one line added with close bracket

Code: Select all

								$output .= '</div>';
								if ($float == '') {
									$output .= '<div style="clear:both"> </div>';
								}
							}
						break;
// added to close loop
}
					}
					$output .= '</div>';
					$iI++;
				}
			}
			
			//--------------------------
			// DISPLAYING OF SWITCHIMAGE
			//--------------------------
Finally need to clear the sub-array. Around line 1558, just the one line is added

Code: Select all

			// ADD JAK DATA CSS style

			if ( $tmpl['detailwindow'] == 6 ) {
				$scriptJAK = '<script type="text/javascript">'
				. 'var dataJakJsPl'.$randName.' = [';
				if (!empty($tmpl['jakdatajs'])) {
					$scriptJAK .= implode($tmpl['jakdatajs'], ',');
				}
				$scriptJAK .= ']'
				. '</script>';
				$document->addCustomTag($scriptJAK);
// added to clear array
				$tmpl['jakdatajs'] = array();				
			}
			
		}
Hope that helps and some one finds it useful.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48676
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Link to multiple images using JAK

Post by Jan »

Hi, thanks for this guide.

Jan
If you find Phoca extensions useful, please support the project
Cast-Art

Re: Link to multiple images using JAK

Post by Cast-Art »

Thanks for this solution!
It works fine in Phoca Gallery Plugin in 3.0.4 too.
Post Reply