Actualisation d'un fichier XML avec PHP

geraldinechx Messages postés 49 Date d'inscription samedi 10 décembre 2005 Statut Membre Dernière intervention 14 mars 2009 - 15 nov. 2007 à 12:28
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 - 15 nov. 2007 à 20:50
Bonjour,

Je viens vers vous car je n'y connais tout simplement rien en PHP et j'aimerais faire en sorte de modifier facilement un fichier XML via un champs texte simple en PHP.

Dans l'état actuel, j'ai créé un fichier XML ("news.xml") avec le code suivant :

"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SCROLL>
ACTUALITE

L'actualité de ce mois de novembre

blablablablablablablablablabla


Bonne journée à tous !

</SCROLL>"

J'ai créé un début de fichier PHP avec un champs texte et un bouton "envoyer" avec l'id "envoi" : j'ai mis le tout dans un tableau avec deux lignes. Dans la dernière ligne, avec le bouton, j'ai mis un champs masqué "action" avec la valeur "ecriture". Et puis c'est tout...je n'ai pas fais grand chose en fait...

"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Actualisation news</title>
<style type="text/css">
<!--
body {
background-color: #666666;
}
.Style1 {
color: #00B5DC;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
-->
</style></head>



ACTUALISATION DES NEWS :


<textarea name="txtNews" cols="35" rows="30" wrap="physical" id="txtNews"></textarea>,

----

<label>

</label>


<label></label>






</html>"


Quelqu'un pourrait-il me dire quel script PHP utilisé et surtout où le placer dans mon document PHP actuel. Je n'ai trouvé aucune ressource sur internet à ce sujet, j'ai aussi essayé via des livres mais sans succès. Ce n'est rien de compliqué, juste un champs texte...
Merci d'avance pour votre précieuse aide et conseils.

Geraldine

1 réponse

malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
15 nov. 2007 à 20:50
Hello,

tu dois te tourner vers DOMDocument :
http://www.php.net/manual/fr/ref.domxml.php

Tu as des tas d'exemples de modifications d'un fichier xml...tu as dû très mal chercher.
Du coup je te donner un de mes codes :
http://www.phpcs.com/codes/PHP5-LOC-CLASSE-BACKOFFICE-INTERNATIONALISATION_44592.aspx
J'y fais tout un tas de mises à jour, lectures etc...via DOM XML ou SIMPLEXML.
0
Rejoignez-nous