Topic: Replace gallery.xml by gallery.php
Hello,
Firstly sorry for English, I'm French!
My question: how to replace the xml file through a php because I want to make sql queries inside!
Thank you;)
A +
You are not logged in. Please login or register.
SimpleViewer Forum → SimpleViewer-Pro v2 → Replace gallery.xml by gallery.php
Hello,
Firstly sorry for English, I'm French!
My question: how to replace the xml file through a php because I want to make sql queries inside!
Thank you;)
A +
Use the galleryURL param to point to the php file. In your php you need to pull your data from your DB and then echo it back as XML that is formatted to match the normal XML. If you search the forums you will see a few example of what others have done.
Hi,
this is in my file index.php
<script type="text/javascript">
var flashvars = {};
flashvars.galleryURL = "gallery.php";
var params = {};
params.wmode = "transparent";
swfobject.embedSWF("simpleviewer.swf","galerie","940","750","10.0.0","js/swfobject/expressinstall.swf",flashvars,params);
</script>
And my file gallery.php:
<?php
include 'elements/connections.php';
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xml .= "<simpleviewergallery
galleryStyle='MODERN'
title=''
textColor='FFFFFF'
frameColor='FFFFFF'
frameWidth='8'
thumbPosition='BOTTOM'
thumbColumns='8'
thumbRows='1'
showOpenButton='FALSE'
showFullscreenButton='FALSE'
maxImageWidth='940'
maxImageHeight='660'
useFlickr='false'
flickrUserName=''
flickrTags=''
languageCode='AUTO'
languageList=''
imagePath='images/'
thumbPath='images/min/'
>\n";
$id=$_GET['id'];
$sql="SELECT * FROM galerie WHERE cat_id=$id";
$req = mysql_query($sql) or die('Erreur SQL!<br/>'.$sql.'<br/>'.mysql_error());
while($data= mysql_fetch_assoc($req)){
$xml .= "<image imageURL='images/{$data["url"]}' thumbURL='images/{$data["url"]}' linkURL='' linkTarget='' >\n";
$xml .= "<caption>{$data["description"]}</caption>\n";
$xml .= "</image>\n";
}
$xml .="</simpleviewergallery>\n\n";
echo $xml;
?>
but it doesn't work!
@+
Try the following
$xml .= "<image imageURL='images/" + {$data['url']} + "' thumbURL='images/" + {$data['url']} + "' linkURL='' linkTarget='' >\n";
$xml .= "<caption>" + {$data['description']} + "</caption>\n";
Merci!
I don't know why but it happens to parse now!
By cons it still can't find file: "Galery XML Not Found"
I think it comes from in the index.php. But normally it's good ... You're sure we can put one .php? lol
++
what is the URL for the gallery.php?
Sorry I don't understand! :/
The address to where the file is located online, http://www._______.whaterver/thefolder/gallery.php
Heu I don't know what I did, it works more!
It comes from two modified lines above, because removing them myself out that although other tags.
It gets weird!
<?php
include 'elements/connections.php';
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xml .= "<simpleviewergallery
galleryStyle='MODERN'
title=''
textColor='FFFFFF'
frameColor='FFFFFF'
frameWidth='8'
thumbPosition='BOTTOM'
thumbColumns='8'
thumbRows='1'
showOpenButton='FALSE'
showFullscreenButton='FALSE'
maxImageWidth='940'
maxImageHeight='660'
useFlickr='false'
flickrUserName=''
flickrTags=''
languageCode='AUTO'
languageList=''
imagePath='images/'
thumbPath='images/min/'
>\n";
$id=$_GET['id'];
$sql="SELECT * FROM galerie WHERE cat_id=$id";
$req = mysql_query($sql) or die('Erreur SQL!<br/>'.$sql.'<br/>'.mysql_error());
while($data= mysql_fetch_assoc($req)){
$xml .= "<image imageURL='images/" + {$data['url']} + "' thumbURL='images/" + {$data['url']} + "' linkURL='' linkTarget='' >\n";
$xml .= "<caption>" + {$data['description']} + "</caption>\n";
$xml .= "</image>\n";
}
$xml .="</simpleviewergallery>\n\n";
echo $xml;
?>
The address to where the file is located online, http://www._______.whaterver/thefolder/gallery.php
I try to put this online
Your XML being produced:
<?xml version='1.0' encoding='UTF-8'?>
<simpleviewergallery
galleryStyle='MODERN'
title=''
textColor='FFFFFF'
frameColor='FFFFFF'
frameWidth='8'
thumbPosition='BOTTOM'
thumbColumns='8'
thumbRows='1'
showOpenButton='FALSE'
showFullscreenButton='FALSE'
maxImageWidth='940'
maxImageHeight='660'
useFlickr='false'
flickrUserName=''
flickrTags=''
languageCode='AUTO'
languageList=''
imagePath='images/'
thumbPath='images/min/'
>
<image imageURL='images/20.03.2010_Z9510_895718_PTL-DLE_dole.jpg' thumbURL='images/20.03.2010_Z9510_895718_PTL-DLE_dole.jpg' linkURL='' linkTarget='' >
<caption>La Z9510 arrive à Dole avec son TER 895718 Pontarlier-Dole. 20 Mars 2010.</caption>
</image>
<br>
<image imageURL='images/27.04.2010_X73745_895552_SCL-DLE_Dole.jpg' thumbURL='images/27.04.2010_X73745_895552_SCL-DLE_Dole.jpg' linkURL='' linkTarget='' >
<caption>TER 895552 St-Claude - Dole arrivant à Destination. 27 Avril 2010.</caption>
</image>
<br>
<image imageURL='images/10.01.2010_colibri_96909_FRA-BNE_Frasne.jpg' thumbURL='images/10.01.2010_colibri_96909_FRA-BNE_Frasne.jpg' linkURL='' linkTarget='' >
<caption>Un Colibri à Frasne, qui s\'apprête à effectuer le RE-96909 Frasne-Berne. 10 Janvier 2010.</caption>
</image>
<br>
<image imageURL='images/10.01.2010_X76679-76680_895768_PTL-FRA_Frasne.jpg' thumbURL='images/10.01.2010_X76679-76680_895768_PTL-FRA_Frasne.jpg' linkURL='' linkTarget='' >
<caption>X76679-76680 sur le 895768 Pontarlier-Frasne, arrivant à Frasne. 10 Janvier 2010.</caption>
</image>
<br>
<image imageURL='images/31.01.2010_SE-116_9261_PLY-LAU_Vessoye.jpg' thumbURL='images/31.01.2010_SE-116_9261_PLY-LAU_Vessoye.jpg' linkURL='' linkTarget='' >
<caption>Le TGV Lyria 9261 Paris-Lausanne passe à la Vessoye. 31 Janvier 2010.</caption>
</image>
<br>
<image imageURL='images/09.02.2010_colibri_Regio-96930_BE-FRA_frasne.jpg' thumbURL='images/09.02.2010_colibri_Regio-96930_BE-FRA_frasne.jpg' linkURL='' linkTarget='' >
<caption>Arrivée du Regio-Express 96930 Berne-Frasne. Frasne, 9 Février 2010.</caption>
</image>
<br>
<image imageURL='images/10.02.2010_draisine_DU65_chasse-neige_Frasne-2.jpg' thumbURL='images/10.02.2010_draisine_DU65_chasse-neige_Frasne-2.jpg' linkURL='' linkTarget='' >
<caption>Déneigement de la section Frasne-Vallobre, par la petite draisine équipée d\'une étrave. 10 Février 2010.</caption>
</image>
<br>
<image imageURL='images/10.02.2010_SE-116_9260_LAU-PLY_Frasne.jpg' thumbURL='images/10.02.2010_SE-116_9260_LAU-PLY_Frasne.jpg' linkURL='' linkTarget='' >
<caption>TGV Lyria (rame 116) sur le 9260 Lausanne-Paris. Frasne, le 10 Février 2010.</caption>
</image>
<br>
<image imageURL='images/10.02.2010_draisine_DU65_gentiane-25_frasne-2.jpg' thumbURL='images/10.02.2010_draisine_DU65_gentiane-25_frasne-2.jpg' linkURL='' linkTarget='' >
<caption>Tempête de neige en gare de Frasne! 10 Février 2010.</caption>
</image>
<br>
<image imageURL='images/10.02.2010_SE-115_9261_PLY-LAU_Frasne.jpg' thumbURL='images/10.02.2010_SE-115_9261_PLY-LAU_Frasne.jpg' linkURL='' linkTarget='' >
<caption>Rame 115 assurant le TGV 9261 Paris-Lausanne. Frasne, le 10 Février 2010.</caption>
</image>
<br>
<image imageURL='images/30.03.2010_lyria_9273_PLY-LAU_Dole.jpg' thumbURL='images/30.03.2010_lyria_9273_PLY-LAU_Dole.jpg' linkURL='' linkTarget='' >
<caption>Passage sur le Doubs du TGV 9273 Paris-Lausanne. Dole, 30 Mars 2010.</caption>
</image>
<br>
<image imageURL='images/19.12.2009_BB26081_226_RM-PBY_Dole-2.jpg' thumbURL='images/19.12.2009_BB26081_226_RM-PBY_Dole-2.jpg' linkURL='' linkTarget='' >
<caption>Suite à des incidents techniques dus à la neige en Italie, le train de nuit 226 Artésia Rome - Paris accuse un retard de 9 heures environ ! Il est vu ici à Dole, au crochet de la BB 26081, du Fret.</caption>
</image>
<br>
<image imageURL='images/21.05.2010_BB26056_221_PBY-VEN_Dole-2.jpg' thumbURL='images/21.05.2010_BB26056_221_PBY-VEN_Dole-2.jpg' linkURL='' linkTarget='' >
<caption>La BB26056 en tête de l\'Artésia 221 Paris-Venise. Dole, le 21 Mai 2010.</caption>
</image>
<br>
<image imageURL='images/24.12.2009_lyria-116_9261_PLY-LA_RE-96909_FRA-BNE_Frasne.jpg' thumbURL='images/24.12.2009_lyria-116_9261_PLY-LA_RE-96909_FRA-BNE_Frasne.jpg' linkURL='' linkTarget='' >
<caption>Le TGV 9261 Paris-Lausanne repart de Frasne en même temps que le Regio-Express 96909 Frasne-Berne. 24 Décembre 2009.</caption>
</image>
<br>
<image imageURL='images/13.12.2009_colibri_RE-96909_FRA-BNE_la-riviere.jpg' thumbURL='images/13.12.2009_colibri_RE-96909_FRA-BNE_la-riviere.jpg' linkURL='' linkTarget='' >
<caption>Premier jour de circulation du Colibri sur la relation Frasne-Berne (Regio-Express 96909). La Rivière, 13 Décembre 2009.</caption>
</image>
<br>
<image imageURL='images/27.10.2009_BB66110_mauzin_Andelot.jpg' thumbURL='images/27.10.2009_BB66110_mauzin_Andelot.jpg' linkURL='' linkTarget='' >
<caption>Une tournée d\'inspection mauzin passe à Andelot, avec la BB66110 en tête. 27 Octobre 2010.</caption>
</image>
<br>
<image imageURL='images/27.10.2009_SE-114_9269_PLY-LAU_les-longevilles.jpg' thumbURL='images/27.10.2009_SE-114_9269_PLY-LAU_les-longevilles.jpg' linkURL='' linkTarget='' >
<caption>Le TGV Lyria 9269 Paris-Lausanne passe aux Longevilles, juste avant le tunnel du Mt D\'Or qui débouche en Suisse. 27 Octobre 2009.</caption>
</image>
<br>
<image imageURL='images/30.09.2009_BB67457_rame-photoprofil_CPG-DPY_Dole.jpg' thumbURL='images/30.09.2009_BB67457_rame-photoprofil_CPG-DPY_Dole.jpg' linkURL='' linkTarget='' >
<caption>Acheminement de la rame photoprofil entre Champagnole et Dijon, par la BB67457, nouvellement transférée à l\'Infra. Dole, le 30 Septembre 2009.</caption>
</image>
<br>
<image imageURL='images/30.09.2009_SE-110_9273_PLY-LAU_Dole.jpg' thumbURL='images/30.09.2009_SE-110_9273_PLY-LAU_Dole.jpg' linkURL='' linkTarget='' >
<caption>TGV 9273 Paris-Lausanne à Dole, le 30 Septembre 2009.</caption>
</image>
<br>
<image imageURL='images/25.07.2009_Z9513-Z9508_895716_PTL-DLE_Frasne.jpg' thumbURL='images/25.07.2009_Z9513-Z9508_895716_PTL-DLE_Frasne.jpg' linkURL='' linkTarget='' >
<caption>Une UM composée des Z9513 et Z9508 assure le TER 895716 Pontarlier-Dole. Frasne, le 25 Juillet 2009.</caption>
</image>
<br>
<image imageURL='images/02.07.2009_SE-116_9268_LAU-PLY_Dole.jpg' thumbURL='images/02.07.2009_SE-116_9268_LAU-PLY_Dole.jpg' linkURL='' linkTarget='' >
<caption>Le TGV 9268 Lausanne-Paris passe à Dole. 2 Juillet 2009.</caption>
</image>
<br>
</simpleviewergallery>
You need to get rid of the <br> tags.
Great it works!
This is my "display file" html/php:
<script type="text/javascript">
var flashvars = {};
flashvars.galleryURL = "viewer.php?id=<?php echo $id;?>";
var params = {};
params.wmode = "transparent";
swfobject.embedSWF("simpleviewer.swf","galerie","1024","900","10.0.0","js/swfobject/expressinstall.swf",flashvars,params);
</script>
and my file xml/php:
<?php
include 'elements/connections.php';
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xml .= "<simpleviewergallery
galleryStyle='MODERN'
title=''
textColor='FFFFFF'
frameColor='FFFFFF'
frameWidth='0'
thumbPosition='BOTTOM'
thumbColumns='8'
thumbRows='1'
showOpenButton='FALSE'
showFullscreenButton='FALSE'
maxImageWidth='1024'
maxImageHeight='900'
useFlickr='false'
flickrUserName=''
flickrTags=''
languageCode='AUTO'
languageList=''
imagePath='images/'
thumbPath='images/min/'
>\n";
$id=$_GET['id'];
$sql="SELECT * FROM galerie WHERE cat_id=$id ORDER BY date DESC";
$req = mysql_query($sql) or die('Erreur SQL!<br/>'.$sql.'<br/>'.mysql_error());
while($data= mysql_fetch_assoc($req)){
$data["description"] = stripslashes($data["description"]);
$xml .= "<image imageURL='images/{$data['url']}' thumbURL='images/min/{$data['url']}' linkURL='' linkTarget='' >\n";
$xml .= "<caption>{$data['description']}</caption>\n";
$xml .= "</image>\n";
}
$xml .="</simpleviewergallery>\n\n";
echo $xml;
?>
Merci beaucoup!!
A+
Welcome back!
Having needs of more than 50 photos per gallery, I went pro, but it is the same problem: it doesn't find the xml! With these parameters shown above, this research still always a file "gallery.xml" what? "
thank you!
@
flashvars.galleryURL = "viewer.php?id=".$id; does not look right try the following instead:
flashvars.galleryURL = "viewer.php?id="+ <?php $id; ?>;
sorry, it doesen't work too!
But when I see the html by firefox, " flashvars.galleryURL = "viewer.php?id=<?php echo $id;?>"; " the syntax is right
@+
If you replace the flashvars.galleryURL line with the following does it work?
flashvars.galleryURL = "http://baptiste-photographies.com/viewer.php?id=1";
If so then you know it is an issue with how you are trying to pass the php variable.
What about the following:
flashvars.galleryURL = ' "viewer.php?id=' + <?php echo $id;?> + '"';
For the test.php page where is the $id var getting its value from? Are you actually setting it to 1 somewhere?
SimpleViewer Forum → SimpleViewer-Pro v2 → Replace gallery.xml by gallery.php
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 5 official extensions. Copyright © 2003–2009 PunBB.