I have a image gallery extension that gets images from a folder through the following xml script:
<?xml version="1.0" encoding="utf-8"?>
<gallery>
<item caption="Photo 01" image="images/image1.jpg" thumb_caption="caption 1" link="empty.html" target="_blank" />
<item caption="Photo 02" image="images/image2.jpg" thumb_caption="caption 2" link="empty.html" target="_blank" />
<item caption="Photo 03" image="images/image3.jpg" thumb_caption="caption 3" link="empty.html" target="_blank" />
<item caption="Photo 04" image="images/image4.jpg" thumb_caption="caption 4" link="empty.html" target="_blank" />
<item caption="Photo 05" image="images/image5.jpg" thumb_caption="caption 5" link="empty.html" target="_blank" />
<item caption="Photo 06" image="images/image6.jpg" thumb_caption="caption 6" link="empty.html" target="_blank" />
</gallery>
I have been told by the suppliers of the extension that I can create a dynamic xml file (in my case with php) so that it retrieves the images from a database, but they haven't been much help in telling me how, but I found
this page from Adobe Labs which shows how to do this but I might be doing something wrong because the extension doesn't identify the xml script, this is what my php file looks like:
<?php require_once('Connections/connUserInfo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$ID_var_rsUserGallery = "0";
if (isset($_GET['ID'])) {
$ID_var_rsUserGallery = $_GET['ID'];
}
mysql_select_db($database_connUserInfo, $connUserInfo);
$query_rsUserGallery = sprintf("SELECT userinfo.ID, userinfo.image1, userinfo.image2, userinfo.image3, userinfo.image4, userinfo.image5, userinfo.image6 FROM userinfo WHERE userinfo.ID = %s", GetSQLValueString($ID_var_rsUserGallery, "int"));
$rsUserGallery = mysql_query($query_rsUserGallery, $connUserInfo) or die(mysql_error());
$row_rsUserGallery = mysql_fetch_assoc($rsUserGallery);
$totalRows_rsUserGallery = mysql_num_rows($rsUserGallery);
mysql_free_result($rsUserGallery);
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
?><?php echo('<?xml version="1.0" encoding="utf-8"?>'); ?>
<images>
<?php if ($totalRows_rsUserGallery > 0) { // Show if recordset not empty ?>
<?php do { ?>
<gallery>
<item caption="Photo 01" image="<?php echo $row_rsUserGallery['image1']; ?>" thumb_caption="caption 1" link="empty.html" target="_blank" />
<item caption="Photo 02" image="<?php echo $row_rsUserGallery['image2']; ?>" thumb_caption="caption 2" link="empty.html" target="_blank" />
<item caption="Photo 03" image="<?php echo $row_rsUserGallery['image3']; ?>" thumb_caption="caption 3" link="empty.html" target="_blank" />
<item caption="Photo 04" image="<?php echo $row_rsUserGallery['image4']; ?>" thumb_caption="caption 4" link="empty.html" target="_blank" />
<item caption="Photo 05" image="<?php echo $row_rsUserGallery['image5']; ?>" thumb_caption="caption 5" link="empty.html" target="_blank" />
<item caption="Photo 06" image="<?php echo $row_rsUserGallery['image6']; ?>" thumb_caption="caption 6" link="empty.html" target="_blank" />
</gallery>
<?php } while ($row_rsUserGallery = mysql_fetch_assoc($rsUserGallery)); ?>
<?php } // Show if recordset not empty ?>
</images>
<?php
mysql_free_result($rsUserGallery);
?>
So I started experimenting with this script and noticed that if I remove the lines:
<images>
<?php if ($totalRows_rsUserGallery > 0) { // Show if recordset not empty ?>
<?php do { ?>
and
<?php } while ($row_rsUserGallery = mysql_fetch_assoc($rsUserGallery)); ?>
<?php } // Show if recordset not empty ?>
</images>
the extension detects the xml script but still none of the images appear in the gallery.
So with the info that I've given, can anyone find anything wrong?
All help is greatly appreciated.