XML editor mit PHP

Flex

(aka Felix Jacobi)
Hast du meinen Beitrag überhaupt gelesen?

Groß- und Kleinschreibung

Genau wie in allen anderen Beiträgen hier im Thread.
 

djpredator69

Grünschnabel
kann mir einer bitte sagen wie ich das vergleichen bei einem mehr dimensionalen arrry hin bekomme

danke




:(
(an die meckerer mir sind die deutschen rechtschreibregeln vollkommen unbekant sorry kann mich zwar auf deusch ausdruecken aber bin kein deutscher)
:(
 

Yaslaw

n/a
Moderator
:(
(an die meckerer mir sind die deutschen rechtschreibregeln vollkommen unbekant sorry kann mich zwar auf deusch ausdruecken aber bin kein deutscher)
:(
Wenn da Gross/Kleinschreibung und Satzzeichen währen, wäre es fast perfektes deutsch. Darf ich fragen wo man so gut Deutsch lernt und dabei die Gross/Kleinschreibung und die Satzzeichen nicht lernt?
Für mich als ebenfalls nicht Deutscher ist es sehr schwer Sätze ohne Satzzeichen zu lesen. Auch bei Wörtern die gross- oder kleingeschrieben unterschiedliche Bedeutungen haben ist es so immer ein Rätselraten.

Zu deiner Frage. Mit array_uintersect().
 

djpredator69

Grünschnabel
also die Funktion ist glaube ich das was ich gesucht habe ,leider weis ich nicht wie ich die jetzt auf mein Array anwenden soll .

Array steht oben ,es ist ein (SimpleXMLElement Object) Array

diese mehr dimensionalen Arrys verstehe ich einfach nicht .
 

djpredator69

Grünschnabel
Also noch mal ich habe folgende xml Dateien :


mein xml Editor:

PHP:
//PHP File Name
$phpname="edit.php";
//Back to GUPPY Admin       
$backto="../../admin/admin.php?lng=fr&pg=plugin&plug=photofolio/admin";       
// Pfad zu deiner Quelldatei
$file = "imgindex.xml";
// Pfad zu deiner Zieldatei
$savefile = "imgindex.xml";
//Version
$version       = " V1.0.2 ";                
//refresh delay
$delay = 3;

$xml = simplexml_load_file($file);
?>

<!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=iso-8859-1" />
<title>XML-Editor</title>


<style type="text/css" media="Screen">

.input1, select {
    border: 1px solid #333333;
    background-color: #99FFCC;
    font-family: Verdana;
    font-size: 18px;
    font-style: bold;
    color: #DF0101;
    text-align: center
}
.input2, select {
    border: 1px solid #333333;
    background-color: #99FFCC;
    font-family: Verdana;
    font-size: 10px;
    font-style: bold;
    color: #000000;
    text-align: center
}
.input3, select {
    border: 1px solid #333333;
    background-color: #FBF9FF;
    font-family: Verdana;
    font-size: 12px;
    font-style: bold;
    color: #000000;
    text-align: center
}

.box1, select {
    width:640px; 
    border-style:double;
    background-color: #FFFF66;
    border-color:red;
    border-radius:10px;
    -moz-border-radius:10px;
    margin: 0px auto;
    
}
.box2, select {
    width:625px; 
    border-style:solid;
    background-color: #666699;
    border-color:;
    border-radius:10px;
    -moz-border-radius:10px;
    margin: 5px auto;
    
}
.box3, select {
    width:635px; 
    border-style:solid;
    background-color: #666699;
    border-color:;
    border-radius:10px;
    -moz-border-radius:10px;
    margin: 0px auto;
    
}


    </style>


</head>

<body>
<?php
if (empty($_POST)) {
?>
<form action="<?php echo "$phpname"; ?>" method="post">
<?php




?>
             
<div align="right">
               
<?php echo "$version"; ?>
               
</div>
               
<?php

foreach ($xml->album as $node) {

echo "<DIV align= \"center\" class=\"box1\">";

$album = $node["name"];

//album titel
echo "<input class=\"input1\" name=\"album\" type=\"text\" value=\"$album\" size=\"30\" border=\"10\" bordercolor=\"RED\" DISABLED/><br />\n<br />\n";

foreach ($node as $node2) {

echo "<DIV align= \"center\" class=\"box2\">";

$i++;


$name = $node2["name"];
$post1 = $node2->comment;
$post2 = $node2->tURL;
$post3 = $node2->lURL;


//foto name
echo "<input class=\"input2\" name=\"name\" type=\"text\" value=\"$name\" size=\"30\" DISABLED/><br />\n";

//foto
echo "<img src= \"albums/$post2\" width=\"150\" height=\"150\"><br />\n";

//comment
echo "<input class=\"input3\" name=\"$i\" type=\"text\" value=\"$post1\" size=\"100\"/><br />\n";

//tURL
echo "<input class=\"input2\" name=\"post2\" type=\"text\" value=\"$post2\" size=\"50\" DISABLED/>\n";

//lURL
echo "<input class=\"input2\" name=\"post3\" type=\"text\" value=\"$post3\" size=\"50\" DISABLED/><br />\n";

//speichern boutton
echo "<input type=\"submit\" name=\"\" value=\"Save all comments\" />\n";

//back to admin
echo "<INPUT TYPE=\"button\" VALUE=\"Back to Admin\" onClick=\"window.location.href='$backto'\"><br /><br />\n";  

echo "</DIV>"; //box2

}

echo "</DIV>"; //box1
 
}

?>



</form>
</body>
</html>


<?php
} else {

////////////////////////////////Speicherung_start//////////////////////////////////////
/*
print_r($xml);
echo "<br>";
echo "<br>";
print_r($_POST);
echo "<br>";
echo "<br>";
*/


$i=0;
foreach ($xml->album as $album) {
    foreach ($album->image as $image) {
        $image->comment = $_POST[++$i];
    }
}  


$xml->asXML($savefile);

//////////////////////////////Speicherung_ende/////////////////////////////////////////


echo "</BODY>";

echo "</HTML>";

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";

echo "<html>";

echo "<head>";

?>

<SCRIPT LANGUAGE="JavaScript">
<!--
var start=new Date();
    start=Date.parse(start)/1000;
    var counts=<?php echo "$delay"; ?>;
    function CountDown(){
        var now=new Date();
        now=Date.parse(now)/1000;
        var x=parseInt(counts-(now-start),10);
        if(document.form1){document.form1.clock.value = x;}
        if(x>0){
            timerID=setTimeout("CountDown()", 100)
        }else{
            location.href="edit.php"
        }
    }
 //-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
//-->
</script>

<?php 

echo "</HEAD>";

echo "<BODY>";

echo "<DIV align= \"center\" class=\"box3\">";

echo "<br>";

//echo "<INPUT TYPE=\"button\" VALUE=\"Back to Edit\" onClick=\"window.location.href='$phpname'\">";  

//echo "<INPUT TYPE=\"button\" VALUE=\"Back to Admin\" onClick=\"window.location.href='$backto'\">";  

echo "<br>";

echo "<br>";

?>
 
<FORM NAME="form1" > 

<font STYLE="text-align: center; color: #F8A569; font-family: Verdana; font-weight: bold; font-size: 16px;">You are being redirected in</font>
 
<INPUT TYPE="text" NAME="clock" SIZE="3" VALUE="10" STYLE="text-align: center; color: #000000; font-family: Verdana; font-weight: bold; font-size: 18px; background-color: #7FFF00;"> 
 
</FORM>

<br>

<font STYLE="text-align: center; color: #00FF00; font-family: Verdana; font-weight: bold; font-size: 18px;">Datei unter <strong> <?php echo "$savefile"; ?> </strong> gespeichert!</font>

<?php 

echo "<br>";

echo "<br>";

echo "</DIV>"; //box3

echo "</body>";

echo "</html>";

}

?>


imgindex.xml (original Datei)

Code:
<?xml version="1.0"?>
<albums>
<album name="chantier">
 <image name="f20110711170">
	 <comment>test</comment>
	 <tURL>chantier/f20110711170.jpg</tURL>
	 <lURL>chantier/f20110711170.jpg</lURL>
 </image>
 <image name="f20110711171">

	 <comment>kevin</comment>
	 <tURL>chantier/f20110711171.jpg</tURL>
	 <lURL>chantier/f20110711171.jpg</lURL>
 </image>
 <image name="f20110711172">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20110711172.jpg</tURL>

	 <lURL>chantier/f20110711172.jpg</lURL>
 </image>
 <image name="f20110711183">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20110711183.jpg</tURL>
	 <lURL>chantier/f20110711183.jpg</lURL>
 </image>

 <image name="f20110925200">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20110925200.jpg</tURL>
	 <lURL>chantier/f20110925200.jpg</lURL>
 </image>
 <image name="f20111143350">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>chantier/f20111143350.jpg</tURL>
	 <lURL>chantier/f20111143350.jpg</lURL>
 </image>
 <image name="f20111143371">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20111143371.jpg</tURL>
	 <lURL>chantier/f20111143371.jpg</lURL>

 </image>
</album>
<album name="coindesamis">
 <image name="f2011023302">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011023302.jpg</tURL>
	 <lURL>coindesamis/f2011023302.jpg</lURL>
 </image>

 <image name="f2011100456">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011100456.JPG</tURL>
	 <lURL>coindesamis/f2011100456.JPG</lURL>
 </image>
 <image name="f2011110834">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>coindesamis/f2011110834.jpg</tURL>
	 <lURL>coindesamis/f2011110834.jpg</lURL>
 </image>
 <image name="f2011110853">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011110853.jpg</tURL>
	 <lURL>coindesamis/f2011110853.jpg</lURL>

 </image>
 <image name="f2011120251">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011120251.jpg</tURL>
	 <lURL>coindesamis/f2011120251.jpg</lURL>
 </image>
 <image name="f2011120456">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011120456.jpg</tURL>
	 <lURL>coindesamis/f2011120456.jpg</lURL>
 </image>
 <image name="f2011120635">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011120635.jpg</tURL>

	 <lURL>coindesamis/f2011120635.jpg</lURL>
 </image>
 <image name="f20110416130">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416130.jpg</tURL>
	 <lURL>coindesamis/f20110416130.jpg</lURL>
 </image>

 <image name="f20110416131">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416131.jpg</tURL>
	 <lURL>coindesamis/f20110416131.jpg</lURL>
 </image>
 <image name="f20110416142">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>coindesamis/f20110416142.jpg</tURL>
	 <lURL>coindesamis/f20110416142.jpg</lURL>
 </image>
 <image name="f20110416143">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416143.jpg</tURL>
	 <lURL>coindesamis/f20110416143.jpg</lURL>

 </image>
 <image name="f20110416164">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416164.jpg</tURL>
	 <lURL>coindesamis/f20110416164.jpg</lURL>
 </image>
 <image name="f20110416165">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416165.jpg</tURL>
	 <lURL>coindesamis/f20110416165.jpg</lURL>
 </image>
 <image name="f20110416166">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416166.jpg</tURL>

	 <lURL>coindesamis/f20110416166.jpg</lURL>
 </image>
 <image name="f20110416177">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416177.jpg</tURL>
	 <lURL>coindesamis/f20110416177.jpg</lURL>
 </image>

</album>
<album name="images">
 <image name="f2011055210">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f2011055210.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f2011055210.jpg</lURL>
 </image>
 <image name="f2011110959">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f2011110959.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f2011110959.jpg</lURL>
 </image>
 <image name="f20110157500">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110157500.jpg</tURL>

	 <lURL>http://www.tutorials.de/images/f20110157500.jpg</lURL>
 </image>
 <image name="f20110417530">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417530.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417530.jpg</lURL>
 </image>

 <image name="f20110417541">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417541.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417541.jpg</lURL>
 </image>
 <image name="f20110417542">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>http://www.tutorials.de/images/f20110417542.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417542.jpg</lURL>
 </image>
 <image name="f20110417543">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417543.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417543.jpg</lURL>

 </image>
 <image name="f20110417554">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417554.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417554.jpg</lURL>
 </image>
 <image name="f20110417555">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417555.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417555.jpg</lURL>
 </image>
 <image name="f20110417566">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417566.jpg</tURL>

	 <lURL>http://www.tutorials.de/images/f20110417566.jpg</lURL>
 </image>
 <image name="f20110417567">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417567.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417567.jpg</lURL>
 </image>

</album>
<album name="test">
 <image name="f2011120351">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f2011120351.jpg</tURL>
	 <lURL>test/f2011120351.jpg</lURL>
 </image>
 <image name="f2011124127">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f2011124127.jpg</tURL>
	 <lURL>test/f2011124127.jpg</lURL>
 </image>
 <image name="f20110711170">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20110711170.jpg</tURL>

	 <lURL>test/f20110711170.jpg</lURL>
 </image>
 <image name="f20110711171">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20110711171.jpg</tURL>
	 <lURL>test/f20110711171.jpg</lURL>
 </image>

 <image name="f20110711172">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20110711172.jpg</tURL>
	 <lURL>test/f20110711172.jpg</lURL>
 </image>
 <image name="f20110711183">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>test/f20110711183.jpg</tURL>
	 <lURL>test/f20110711183.jpg</lURL>
 </image>
 <image name="f20111143371">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20111143371.jpg</tURL>
	 <lURL>test/f20111143371.jpg</lURL>

 </image>
</album>
</albums>


die 2te Datei ist imgindex2.xml (Backup Datei)

Code:
<?xml version="1.0"?>
<albums>
<album name="chantier">
 <image name="f20110711170">
	 <comment>test</comment>
	 <tURL>chantier/f20110711170.jpg</tURL>
	 <lURL>chantier/f20110711170.jpg</lURL>
 </image>
 <image name="f20110711171">

	 <comment>kevin</comment>
	 <tURL>chantier/f20110711171.jpg</tURL>
	 <lURL>chantier/f20110711171.jpg</lURL>
 </image>
 <image name="f20110711172">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20110711172.jpg</tURL>

	 <lURL>chantier/f20110711172.jpg</lURL>
 </image>
 <image name="f20110711183">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20110711183.jpg</tURL>
	 <lURL>chantier/f20110711183.jpg</lURL>
 </image>

 <image name="f20110925200">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20110925200.jpg</tURL>
	 <lURL>chantier/f20110925200.jpg</lURL>
 </image>
 <image name="f20111143350">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>chantier/f20111143350.jpg</tURL>
	 <lURL>chantier/f20111143350.jpg</lURL>
 </image>
 <image name="f20111143371">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>chantier/f20111143371.jpg</tURL>
	 <lURL>chantier/f20111143371.jpg</lURL>

 </image>
</album>
<album name="coindesamis">
 <image name="f2011023302">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011023302.jpg</tURL>
	 <lURL>coindesamis/f2011023302.jpg</lURL>
 </image>

 <image name="f2011100456">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011100456.JPG</tURL>
	 <lURL>coindesamis/f2011100456.JPG</lURL>
 </image>
 <image name="f2011110834">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>coindesamis/f2011110834.jpg</tURL>
	 <lURL>coindesamis/f2011110834.jpg</lURL>
 </image>
 <image name="f2011110853">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011110853.jpg</tURL>
	 <lURL>coindesamis/f2011110853.jpg</lURL>

 </image>
 <image name="f2011120251">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011120251.jpg</tURL>
	 <lURL>coindesamis/f2011120251.jpg</lURL>
 </image>
 <image name="f2011120456">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011120456.jpg</tURL>
	 <lURL>coindesamis/f2011120456.jpg</lURL>
 </image>
 <image name="f2011120635">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f2011120635.jpg</tURL>

	 <lURL>coindesamis/f2011120635.jpg</lURL>
 </image>
 <image name="f20110416130">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416130.jpg</tURL>
	 <lURL>coindesamis/f20110416130.jpg</lURL>
 </image>

 <image name="f20110416131">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416131.jpg</tURL>
	 <lURL>coindesamis/f20110416131.jpg</lURL>
 </image>
 <image name="f20110416142">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>coindesamis/f20110416142.jpg</tURL>
	 <lURL>coindesamis/f20110416142.jpg</lURL>
 </image>
 <image name="f20110416143">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416143.jpg</tURL>
	 <lURL>coindesamis/f20110416143.jpg</lURL>

 </image>
 <image name="f20110416164">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416164.jpg</tURL>
	 <lURL>coindesamis/f20110416164.jpg</lURL>
 </image>
 <image name="f20110416165">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416165.jpg</tURL>
	 <lURL>coindesamis/f20110416165.jpg</lURL>
 </image>
 <image name="f20110416166">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416166.jpg</tURL>

	 <lURL>coindesamis/f20110416166.jpg</lURL>
 </image>
 <image name="f20110416177">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>coindesamis/f20110416177.jpg</tURL>
	 <lURL>coindesamis/f20110416177.jpg</lURL>
 </image>

</album>
<album name="images">
 <image name="f2011055210">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f2011055210.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f2011055210.jpg</lURL>
 </image>
 <image name="f2011110959">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f2011110959.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f2011110959.jpg</lURL>
 </image>
 <image name="f20110157500">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110157500.jpg</tURL>

	 <lURL>http://www.tutorials.de/images/f20110157500.jpg</lURL>
 </image>
 <image name="f20110417530">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417530.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417530.jpg</lURL>
 </image>

 <image name="f20110417541">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417541.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417541.jpg</lURL>
 </image>
 <image name="f20110417542">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>http://www.tutorials.de/images/f20110417542.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417542.jpg</lURL>
 </image>
 <image name="f20110417543">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417543.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417543.jpg</lURL>

 </image>
 <image name="f20110417554">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417554.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417554.jpg</lURL>
 </image>
 <image name="f20110417555">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417555.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417555.jpg</lURL>
 </image>
 <image name="f20110417566">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417566.jpg</tURL>

	 <lURL>http://www.tutorials.de/images/f20110417566.jpg</lURL>
 </image>
 <image name="f20110417567">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>http://www.tutorials.de/images/f20110417567.jpg</tURL>
	 <lURL>http://www.tutorials.de/images/f20110417567.jpg</lURL>
 </image>

</album>
<album name="test">
 <image name="f2011120351">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f2011120351.jpg</tURL>
	 <lURL>test/f2011120351.jpg</lURL>
 </image>
 <image name="f2011124127">

	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f2011124127.jpg</tURL>
	 <lURL>test/f2011124127.jpg</lURL>
 </image>
 <image name="f20110711170">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20110711170.jpg</tURL>

	 <lURL>test/f20110711170.jpg</lURL>
 </image>
 <image name="f20110711171">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20110711171.jpg</tURL>
	 <lURL>test/f20110711171.jpg</lURL>
 </image>

 <image name="f20110711172">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20110711172.jpg</tURL>
	 <lURL>test/f20110711172.jpg</lURL>
 </image>
 <image name="f20110711183">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>

	 <tURL>test/f20110711183.jpg</tURL>
	 <lURL>test/f20110711183.jpg</lURL>
 </image>
 <image name="f20111143371">
	 <comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
	 <tURL>test/f20111143371.jpg</tURL>
	 <lURL>test/f20111143371.jpg</lURL>

 </image>
</album>
</albums>


Also mein Editor funktioniert ein wandfrei habe leider das Problem ,dass wenn ich wieder ein Update der xml Datei 1 mache wird die komplett ersetzt und so verliere ich alle editierten Comments und die werden wieder auf 0 gesetzt.

Da ich das orginal Programm das die xml erstellt und updatet nicht ändern kann habe ich mir gedacht dass ich das mit meinem Editor beheben kann.

Also alle Date werden ja einzeln aus der imgindex.xml ausgelesen, jetzt möchte ich dass wenn der forgende Wert <image name=""> ausgelesen wir ,soll dieser mit der Datei imgindex2.xml verglichen werden .

Wenn der Wert existiert soll aus dieser Datei das dazu gehörende <comment> ausgegeben werden , so dass ich diesen Wert in der Inputausgabe benutzen kann .

Beispiel :

in imgindex.xml steht:

<image name="f20110711170">
<comment>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality</comment>
<tURL>chantier/f20110711170.jpg</tURL>
<lURL>chantier/f20110711170.jpg</lURL>
</image>

und in der imgindex2.xml steht:

<image name="f20110711170">
<comment>test</comment>
<tURL>chantier/f20110711170.jpg</tURL>
<lURL>chantier/f20110711170.jpg</lURL>
</image>

so soll im Input der das commment anzeigt folgender Wert stehen :

test


Ich hoffe es wurden alle Regeln jetzt eingehalten und ihr könnt mir bei diesem Problem weiterhelfen

weiter erklärungen auf anfrage

Danke
 
Zuletzt bearbeitet:

djpredator69

Grünschnabel
ich glaube ich habe selbst eine Loesung gefunden sie ist vielleich nicht ganz sauber aber es funktioniert so wie ich das wollte

hier meine letzte Version des Scripts :

PHP:
<?php
//PHP File Name
$phpname="edit.php";
//Back to GUPPY Admin       
$backto="../../admin/admin.php?lng=fr&pg=plugin&plug=photofolio/admin";       
// Pfad zu deiner Quelldatei
$file1 = "imgindex.xml";
// Pfad zu deiner BackupQuelldatei
$file2 = "comments/imgindex2.xml";
// Pfad zu deiner Zieldatei
$savefile1 = "imgindex.xml";
// Pfad zu deiner BackupZieldatei
$savefile2 = "comments/imgindex2.xml";
//Version
$version       = " V1.0.4 ";                
//refresh delay
$delay = 3;

$xml1 = simplexml_load_file($file1);

$xml2 = simplexml_load_file($file2);

?>

<!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=iso-8859-1" />
<title>XML-Editor</title>


<style type="text/css" media="Screen">

.input1, select {
    border: 1px solid #333333;
    background-color: #99FFCC;
    font-family: Verdana;
	font-size: 18px;
	font-style: bold;
    color: #DF0101;
    text-align: center
}
.input2, select {
    border: 1px solid #333333;
    background-color: #99FFCC;
    font-family: Verdana;
	font-size: 10px;
	font-style: bold;
    color: #000000;
    text-align: center
}
.input3, select {
    border: 1px solid #333333;
    background-color: #FBF9FF;
    font-family: Verdana;
	font-size: 12px;
	font-style: bold;
    color: #000000;
    text-align: center
}

.box1, select {
    width:640px; 
    border-style:double;
    background-color: #FFFF66;
    border-color:red;
    border-radius:10px;
    -moz-border-radius:10px;
    margin: 0px auto;
    
}
.box2, select {
    width:625px; 
    border-style:solid;
    background-color: #666699;
    border-color:;
    border-radius:10px;
    -moz-border-radius:10px;
    margin: 5px auto;
    
}
.box3, select {
    width:635px; 
    border-style:solid;
    background-color: #666699;
    border-color:;
    border-radius:10px;
    -moz-border-radius:10px;
    margin: 0px auto;
    
}


    </style>


</head>

<body>
<?php
if (empty($_POST)) {
?>
<form action="<?php echo "$phpname"; ?>" method="post">
<?php




?>
             
<div align="right">
               
<?php echo "$version"; ?>
               
</div>
               
<?php

foreach ($xml1->album as $node) {

echo "<DIV align= \"center\" class=\"box1\">";

$album = $node["name"];

//album titel
echo "<input class=\"input1\" name=\"album\" type=\"text\" value=\"$album\" size=\"30\" border=\"10\" bordercolor=\"RED\" DISABLED/><br />\n<br />\n";

foreach ($node as $node2) {
$i++;
echo "<DIV align= \"center\" class=\"box2\">";







$name = $node2["name"];
$post1 = $node2->comment;
$post2 = $node2->tURL;
$post3 = $node2->lURL;

/////////////////////////////////////////test start//////////////////////////////////
//soll nur funktionieren wenn imgindex2.xlm existiert


$filename = $savefile2;

if (file_exists($filename)) {


$bildname = $name;


$result1 = $xml1->xpath("///image[@name='$bildname']/comment");
/*
while(list( , $node1) = each($result1)) {
    echo '<div align=center>';
    echo 'XML1 -> comment: ',$node1,"<br>";
    echo '</div>';
}
*/
//print_r($result1);
//echo "$result1[0]";


$result2 = $xml2->xpath("///image[@name='$bildname']/comment");
/*
while(list( , $node2) = each($result2)) {
    echo '<div align=center>';
    echo 'XML2 -> comment: ',$node2,"<br>";
    echo '</div>';
}
*/
//print_r($result2);
//echo "$result2[0]";



if ($result1[0] == $result2[0])
{
//echo "lade wert aus xml1 -> ",$result1[0],"<br>";
$post1 = $result1[0];
}

elseif (empty($result2[0]))
{
//echo "lade wert aus xml1 -> ",$result1[0],"<br>";
$post1 = $result1[0];
}

else
{
//echo "lade wert aus xml2 -> ",$result2[0],"<br>";
$post1 = $result2[0];
}

}
/////////////////////////////////////////test ende///////////////////////////////////


//foto name
echo "<input class=\"input2\" name=\"name\" type=\"text\" value=\"$name\" size=\"30\" DISABLED/><br />\n";

//foto
echo "<img src= \"albums/$post2\" width=\"150\" height=\"150\"><br />\n";

//comment
echo "<input class=\"input3\" name=\"$i\" type=\"text\" value=\"$post1\" size=\"100\"/><br />\n";

//tURL
echo "<input class=\"input2\" name=\"post2\" type=\"text\" value=\"$post2\" size=\"50\" DISABLED/>\n";

//lURL
echo "<input class=\"input2\" name=\"post3\" type=\"text\" value=\"$post3\" size=\"50\" DISABLED/><br />\n";

//speichern boutton
echo "<input type=\"submit\" name=\"\" value=\"Save all comments\" />\n";

//back to admin
echo "<INPUT TYPE=\"button\" VALUE=\"Back to Admin\" onClick=\"window.location.href='$backto'\"><br /><br />\n";  

echo "</DIV>"; //box2

}

echo "</DIV>"; //box1
 
}

?>



</form>
</body>
</html>


<?php
} else {

////////////////////////////////Speicherung_start//////////////////////////////////////



$i=0;
foreach ($xml1->album as $album) {
    foreach ($album->image as $image) {
        $image->comment = $_POST[++$i];
    }
}  


$xml1->asXML($savefile1);
$xml1->asXML($savefile2);

//////////////////////////////Speicherung_ende/////////////////////////////////////////


echo "</BODY>";

echo "</HTML>";

echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";

echo "<html>";

echo "<head>";

?>

<SCRIPT LANGUAGE="JavaScript">
<!--
var start=new Date();
	start=Date.parse(start)/1000;
	var counts=<?php echo "$delay"; ?>;
	function CountDown(){
		var now=new Date();
		now=Date.parse(now)/1000;
		var x=parseInt(counts-(now-start),10);
		if(document.form1){document.form1.clock.value = x;}
		if(x>0){
			timerID=setTimeout("CountDown()", 100)
		}else{
			location.href="<?php echo "$phpname"; ?>"
		}
	}
 //-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
//-->
</script>

<?php 

echo "</HEAD>";

echo "<BODY>";

echo "<DIV align= \"center\" class=\"box3\">";

echo "<br>";

//echo "<INPUT TYPE=\"button\" VALUE=\"Back to Edit\" onClick=\"window.location.href='$phpname'\">";  

//echo "<INPUT TYPE=\"button\" VALUE=\"Back to Admin\" onClick=\"window.location.href='$backto'\">";  

echo "<br>";

echo "<br>";

?>
 
<FORM NAME="form1" > 

<font STYLE="text-align: center; color: #F8A569; font-family: Verdana; font-weight: bold; font-size: 16px;">You are being redirected in</font>
 
<INPUT TYPE="text" NAME="clock" SIZE="3" VALUE="10" STYLE="text-align: center; color: #000000; font-family: Verdana; font-weight: bold; font-size: 18px; background-color: #7FFF00;"> 
 
</FORM>

<br>

<font STYLE="text-align: center; color: #00FF00; font-family: Verdana; font-weight: bold; font-size: 18px;">Datei unter <?php echo "$savefile1"; ?> gespeichert!</font>

<?php 

echo "<br>";

echo "<br>";

echo "</DIV>"; //box3

echo "</body>";

echo "</html>";

}

?>


die neuen Zeilen befinden sich jetzt zwischen (test start) und (test ende):p