I am trying to get the best of both worlds here...
site:
http://philmontforum.com - a Joomla installation with Mehdi's Coppermine Bridge
I have deployed two different cmpFetch php files into my Joomla homepage that show either a) 1 350px wide random image from cpg; or b) 1x4 random thumbnail images. These are selected on the home page randomly by the Joomla front page component. Both of these cpmFetch php files include a modified version the EnlargeIt script (found
here) and it works perfectly. Now I'm trying to include the ajax refresh (found
here) into this file. If you are going to the site, you may have to reload the home page a few times until the correct php file is loaded. It will be the one with the "
Get another photo" link above the single photo. The "Get another photo" link just doesn't work. Therein lies the problem...
I know pretty much nothing about coding, but have gotten the coding to work to the point that EnlargeIt still works and I have a "refresh" link to appear above the random image that calls the java (ajax) scripting.
I fear that I need to work on the java script, and I don't know what to change...
php file path: pf.com/cms/images/jumienlargeit1x1ajaxrefresh.php
gal-samp.js path: pf.com/cms/images/Source/ajax-galsamp.js
pf.com = philmontforum.com... Not sure what other paths you might need...
Here is the jumienlargeit1x1ajaxrefresh.php file:
<?php
//
// Gallery Coppermine script by P.J.Lawrence (October 2008)
// Disclaimer: This mod is provided "as is" without express or implied warranty.
//
// Using...
// Enlargeit Script (http://enlargeit.timos-welt.de/english/index.php)
// CpmFetch http://cpmfetch.fistfullofcode.com/
//
// Notes..
// Ensure that the variable enl_gifpath in enlargeit.js points to the correct directory
$CoppermineWebPath = '../cpg/'; // Web path to Coppermine Gallery
$EnlargeitWebPath = '/Source/'; // Web path to Enlargeit java code
$cpmfetchPath = '../cpg/cpmfetch/'; // System Path to CPMFetch
if ($_GET['rows']) {
$Rows=(int) $_GET['rows'];
}
else {
$Rows=1;
}
if ($_GET['cols']) {
$Cols=(int) $_GET['cols'];
}
else {
$Cols = 1;
}
include $cpmfetchPath."cpmfetch.php";
echo '<script type="text/javascript" src="images/Source/enlargeit.js"></script>';
echo '<script type="text/javascript" src="images/Source/ajax-galsamp.js" /></script>';
echo '<CENTER>';
echo '<div id=ajax-galsamp>';
echo '<a href="javascript:getGalsamp()">Get another photo</a>';
$objCpm = new cpm($cpmfetchPath."cpmfetch_config.php");
$option = array(
'linkstyle' =>'image" target="_blank" onclick="return false;',
'imagestyle' =>'set1" onclick="enlarge(this);',
"imagesize" => "large" ,
"imagewidth" => "350" ,
'alttag' => '{{pFilename}}" id="{{pPid}}" longdesc="'.$CoppermineWebPath.'albums/{{pFilepath}}{{pFilename}}',
//'tablestyle' => 'windowbg" width="150" bordercolor="#0099ff" border="5" height="150"',
"tablestyle" => "cpmfetch");
$objCpm->cpm_viewRandomMediaFrom("cat=2,3,4,5,7",$Rows,$Cols,$option);
$objCpm->cpm_close();
echo '<a href="'.$CoppermineWebPath.'">| View the Photo Gallery |</a>';
echo '</div>';
echo '</center>';
?>
Here is the ajax-galsamp.js code:
function getGalsamp() {
var xmlHttpGalsamp=null;
try {
xmlHttpGalsamp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttpGalsamp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttpGalsamp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlHttpGalsamp.onreadystatechange = function() {
if (xmlHttpGalsamp.readyState == 4)
try {
if (xmlHttpGalsamp.status == 200) {
document.getElementById("ajax-galsamp").innerHTML
= xmlHttpGalsamp.responseText;
}
} catch (e) {
document.getElementById("ajax-galsamp").innerHTML
= "Error on Ajax return call : " + e.description;
}
}
xmlHttpGalsamp.open("get","jumienlargeit1x1ajaxrefresh.php");
xmlHttpGalsamp.send(null);
}
ajaxGetGalsamp();
Is there a way to do this without the <div id=ajax-galsamp> and </div> around the cpmFetch code in the php file?
Any help here would be great.
Even if it doesn't/can't work, both of these cpmFetch additions (EnlargeIt & Ajax refresh) are great, and I want to say thanks to both contributors.