Bonjour à tous.

Je suis quelqu'un qui utilise php mysql depuis des années mais pour de simple requête sql et affichage php.

Et la j'ai envie d'utiliser un coverflow flash qui affiche des images grâce à un fichier xml appelé albuminfo.xml

J'aimerais qu'à chaque fois que l'administrateur du site ajoute ou supprime une photo d'un dossier spécifique, cela appelle la page modifxml.php qui elle modifie automatiquement toute la page xml (et donc le diaporama de photos).

voila comment est fait le fichier albuminfo.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
<artworkinfo>           
            <albuminfo>
	      <artLocation>images/z11.jpg</artLocation>
	</albuminfo>
	<albuminfo>
	       <artLocation>images/z12.jpg</artLocation>
	</albuminfo>
</artworkinfo>
Voici ma page modifxml.php situé dans un dossier admin :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Modification fichier xml</title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
<link href="style.css" rel="stylesheet" type="text/css" />
 
 
</head>
 
<body>
<?php 
//******************************************************************************************************** 
//génération XML 
//******************************************************************************************************** 
 
$xml_upload = "../images/galerie/"; 
 
   //on ouvre le repertoire
   $pointeur = opendir($xml_upload);
   $i = 0;
 
	$filename = '../albuminfo.xml'; 
	$newContent = "<artworkinfo>"; 
 
 
 
   //on les stocke les noms de fichiers images dans un tableau
   while ($fichier = readdir($pointeur))
   {      
      if (substr($fichier, -3) == "gif" || substr($fichier, -3) == "jpg" || substr($fichier, -3) == "png" || substr($fichier, -4) == "jpeg" || substr($fichier, -3) == "PNG" || substr($fichier, -3) == "GIF" || substr($fichier, -3) == "JPG")
      {
 
 
		 $chemin="images/galerie/".$fichier;
		 $newContent .= "<albuminfo><artLocation>".$chemin."</artLocation></albuminfo>"; 
 
 
	  }      
   }
 
$newContent .= "</artworkinfo>";
$content = file_get_contents($filename);  
$newContent = str_replace($content, $newContent, $content); 
 
$handle = fopen($filename, 'w'); 
fwrite($handle, $newContent); 
fclose($handle); 
if (fwrite) { 
 
echo "Diaporama mis à jour"; 
 
} 
?>
</body>
</html>
Ce code me modifie bien tout le fichier xml par ce que je désire mais j'ai un message d'erreur :

Notice: Use of undefined constant fwrite - assumed 'fwrite' in C:\wamp\www\siteaez\admin\modifxml.php on line 49

J'aimerais vraiment solutionner cela même si cela fonctionne quand même.

Merci d'avance