1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>xml</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php require_once('connectionbdd.php');
function Display($Value) {
return htmlspecialchars(addslashes($Value));
}
//$cat = $_GET['categorie'];
$parent = 4;
$id = 16;
$connection = mysql_connect($hostname_connectionbdd, $username_connectionbdd, $password_connectionbdd) or die("host : connexion impossible.");
mysql_select_db($database_connectionbdd, $connection) or die("Base de donnée non trouvé.");
$query2 = "SELECT * FROM categorie WHERE link_categorie = $parent" ;
$result2 = mysql_query($query2, $connection) or die("Impossible d'interroger la base de données");
$num2 = mysql_num_rows($result2);
$j = 0;
$id2 = "";
$resultat2 = @mysql_query($query2);
while ($donnees2=mysql_fetch_array($resultat2)){
$id2 = urlencode(utf8_encode($donnees2['id_categorie']));
$j++;
$query = "SELECT * FROM articles WHERE idparent_articles = $parent AND idcat_articles = $id2" ;
$result = mysql_query($query, $connection) or die("Impossible d'interroger la base de données");
$num = mysql_num_rows($result);
$resultat = @mysql_query($query);
$i = 0;
$id = "";
// on parcourt le résultat de la requête
while ($donnees=mysql_fetch_array($resultat)){
// et on concatène les résultats dans une variable listeResultats
$id = urlencode(utf8_encode($donnees['idcat_articles']));
$i++;
if ($num != 0) {
$file= fopen($id."_"."gallery.xml", "w");
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$_xml .="<simpleviewerGallery
maxImageWidth = '350'
maxImageHeight = '350'
textColor = '0x000000'
frameColor = '0x000000'
frameWidth = '0'
stagePadding = '40'
thumbnailColumns = '3'
thumbnailRows = '2'
navPosition = 'top'
navPadding = '30'
title = '$rub1'
enableRightClickOpen = 'false'
backgroundImagePath = ''
vAlign = 'top'
hAlign = 'left'
imagePath = /images/'
thumbPath = /images/'>\r\n";
while ($r = mysql_fetch_array($result)) {
$_xml .= '<image>
<filename>'.utf8_encode($r['images_articles']).'</filename>
<caption>'.utf8_encode($r['comment_articles']).'</caption>';
$_xml .= "</image>\r\n";
}
}
$_xml .="</export>";
if ($num != 0) {
fwrite($file, $_xml);
fclose($file);
}
else
echo "Pas d'articles pour l'instant dans cette rubrique." ;
}
};
echo $id2;
?>
</body>
</html> |