SOLVED: Slideshow Plugin + External Link from picture

Phoca Gallery plugins - plugins for Phoca Gallery extension
maxschaf
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 07 Nov 2009, 01:58

SOLVED: Slideshow Plugin + External Link from picture

Post by maxschaf »

Hallo,

is it possible, to add an external link to every photo in the slideshow?
just realised that it is not possible to just add the link to "Externer Link 1:" in the backend. Is there a chance to realise this with phoca slideshow?
i have a ads category sliding at my page and i need to add weblinks to some of the pictures.

an idee? thanks a lot!
Last edited by maxschaf on 09 Nov 2009, 22:56, edited 2 times in total.
maxschaf
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 07 Nov 2009, 01:58

Re: Slideshow Plugin + External Link from picture

Post by maxschaf »

in phocagalleryslideshow.js is code to add links:

Code: Select all

fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML="<div style=\"text-align:center;valign:middle\">"
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
how to save the link into the array in phocagalleryslideshow.php and start this function above?
maxschaf
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 07 Nov 2009, 01:58

Re: Slideshow Plugin + External Link from picture

Post by maxschaf »

having links is possible with this slideshow, but it's not implemented in "phocagalleryslideshow.php".

changes to get it working:

Add this to the databasequery: ~line 76

Code: Select all

$query     = ' SELECT a.filename, a.extlink1' 

a.extlink1 has to be added

this gets the data entered in phoca gallery backend to each foto at "extern link1:, title:, target:" (or so, i'm using the german version :) )
In your database these data is saved in the above mentioned order separated with "|". f.e. "www.google.at|TITEL|_blank|1"

then go on to line ~108 and insert these lines

Code: Select all

//fadeimages2[2]=["photo3.jpg", "http://www.javascriptkit.com", "_new"] //image with link and target syntax
$imageLink = $images[$i]->extlink1;
$link = explode("|", $imageLink);
$realLink = $link[0];
$realTarget = $link[2];


and now manipulate the script line afterwards:

Code: Select all

$script .= 'fadeimages'.$c.'['.$i.'] = [\'' . JURI::base(true).'/'.$imageName->rel . '\', 
\''.$realLink.'\', \''.$realTarget.'\'];'. "\n";

you can also hardcode target, to f.e. open all links in a new browser page:

Code: Select all

$script .= 'fadeimages'.$c.'['.$i.'] = [\'' . JURI::base(true).'/'.$imageName->rel . '\',
 \''.$realLink.'\', \'_new\'];'. "\n";


I hope that i could contribute a little work to great phoca gallery!
maxschaf
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 07 Nov 2009, 01:58

Re: SOLVED: Slideshow Plugin + External Link from picture

Post by maxschaf »

probably need to add this:
~line 113

Code: Select all

					$http = "http://";
					if(empty($realLink)) $http = "";
and modify script output:

Code: Select all

$script .= 'fadeimages'.$c.'['.$i.'] = [\'' . JURI::base(true).'/'.$imageName->rel . '\', \''.$http.''.$realLink.'\', \''.$realTarget.'\'];'. "\n";
Post Reply