XML editor mit PHP


djpredator69

Grünschnabel
hi ich habe da mal ein problem ich kenne mich nicht so gut aus mit arrays

ich habe array 1 das ist ein kommpletter auszug aus einer xml datei estellt mit simple_xml

die daten werden in einer html ausgegeben , so im from jetzt können die einträge der comments verändert werden , die wiederum werden in array2 gespeichert und übergeben

das funktioniert alles, hier mal der code:
PHP:
<?php
//PHP File Name
$phpname="edit2.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 = "imgindex2.xml";

$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>
</head>

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





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

$album = $node["name"];

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

foreach ($node as $node2) {
$i++;


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

//

echo "<input name=\"name\" type=\"text\" value=\"$name\" size=\"30\" DISABLED/><br />\n";
echo "<input name=\"$i\" type=\"text\" value=\"$post1\" size=\"100\"/><br />\n";
echo "<input name=\"post2\" type=\"text\" value=\"$post2\" size=\"30\" DISABLED/>\n";
echo "<input name=\"post3\" type=\"text\" value=\"$post3\" size=\"30\" DISABLED/><br />\n<br />\n";

}

}

?>
<input type="submit" name="" value="Speichern" />


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


<?php
} else {

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

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









$xml2 = $xml;




$xml2->asXML($savefile);

//////////////////////////////Speicherung_ende/////////////////////////////////////////
?>
<div align="center">
 <INPUT TYPE="button" VALUE="Back to Edit" onClick="window.location.href='<?php echo "$phpname"; ?>'">  
 <INPUT TYPE="button" VALUE="Back to Admin" onClick="window.location.href='<?php echo "$backto"; ?>'">  
</div>
<?php


echo "Datei unter <strong> $savefile </strong> gespeichert!\n";
echo "</body>\n";
echo "</html>";
}
?>


sorry für die nächsten zeilen ich weis nicht wie ich die besser darstellen soll


array 1:
Code:
SimpleXMLElement Object
(
    [album] =&gt; Array
        (
            [0] =&gt; SimpleXMLElement Object
                (
                    [@attributes] =&gt; Array
                        (
                            [name] =&gt; coindesamis
                        )

                    [image] =&gt; Array
                        (
                            [0] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011023302
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011023302.jpg
                                    [lURL] =&gt; coindesamis/f2011023302.jpg
                                )

                            [1] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011100456
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011100456.JPG
                                    [lURL] =&gt; coindesamis/f2011100456.JPG
                                )

                            [2] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011110834
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011110834.jpg
                                    [lURL] =&gt; coindesamis/f2011110834.jpg
                                )

                            [3] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011110853
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011110853.jpg
                                    [lURL] =&gt; coindesamis/f2011110853.jpg
                                )

                            [4] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120251
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011120251.jpg
                                    [lURL] =&gt; coindesamis/f2011120251.jpg
                                )

                            [5] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120456
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011120456.jpg
                                    [lURL] =&gt; coindesamis/f2011120456.jpg
                                )

                            [6] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120635
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011120635.jpg
                                    [lURL] =&gt; coindesamis/f2011120635.jpg
                                )

                            [7] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416130
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416130.jpg
                                    [lURL] =&gt; coindesamis/f20110416130.jpg
                                )

                            [8] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416131
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416131.jpg
                                    [lURL] =&gt; coindesamis/f20110416131.jpg
                                )

                            [9] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416142
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416142.jpg
                                    [lURL] =&gt; coindesamis/f20110416142.jpg
                                )

                            [10] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416143
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416143.jpg
                                    [lURL] =&gt; coindesamis/f20110416143.jpg
                                )

                            [11] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416164
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416164.jpg
                                    [lURL] =&gt; coindesamis/f20110416164.jpg
                                )

                            [12] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416165
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416165.jpg
                                    [lURL] =&gt; coindesamis/f20110416165.jpg
                                )

                            [13] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416166
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416166.jpg
                                    [lURL] =&gt; coindesamis/f20110416166.jpg
                                )

                            [14] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416177
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416177.jpg
                                    [lURL] =&gt; coindesamis/f20110416177.jpg
                                )

                        )

                )

            [1] =&gt; SimpleXMLElement Object
                (
                    [@attributes] =&gt; Array
                        (
                            [name] =&gt; images
                        )

                    [image] =&gt; Array
                        (
                            [0] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011055210
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f2011055210.jpg
                                    [lURL] =&gt; images/f2011055210.jpg
                                )

                            [1] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011110959
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f2011110959.jpg
                                    [lURL] =&gt; images/f2011110959.jpg
                                )

                            [2] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110157500
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110157500.jpg
                                    [lURL] =&gt; images/f20110157500.jpg
                                )

                            [3] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417530
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417530.jpg
                                    [lURL] =&gt; images/f20110417530.jpg
                                )

                            [4] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417541
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417541.jpg
                                    [lURL] =&gt; images/f20110417541.jpg
                                )

                            [5] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417542
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417542.jpg
                                    [lURL] =&gt; images/f20110417542.jpg
                                )

                            [6] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417543
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417543.jpg
                                    [lURL] =&gt; images/f20110417543.jpg
                                )

                            [7] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417554
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417554.jpg
                                    [lURL] =&gt; images/f20110417554.jpg
                                )

                            [8] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417555
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417555.jpg
                                    [lURL] =&gt; images/f20110417555.jpg
                                )

                            [9] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417566
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417566.jpg
                                    [lURL] =&gt; images/f20110417566.jpg
                                )

                            [10] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417567
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417567.jpg
                                    [lURL] =&gt; images/f20110417567.jpg
                                )

                        )

                )

            [2] =&gt; SimpleXMLElement Object
                (
                    [@attributes] =&gt; Array
                        (
                            [name] =&gt; test
                        )

                    [image] =&gt; Array
                        (
                            [0] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120351
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; test/f2011120351.jpg
                                    [lURL] =&gt; test/f2011120351.jpg
                                )

                            [1] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011124127
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; test/f2011124127.jpg
                                    [lURL] =&gt; test/f2011124127.jpg
                                )

                        )

                )

        )

)



array 2:

Code:
Array
(
    [1] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [2] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [3] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [4] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [5] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [6] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [7] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [8] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [9] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [10] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [11] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [12] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [13] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [14] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [15] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [16] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [17] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [18] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [19] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [20] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [21] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [22] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [23] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [24] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [25] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [26] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [27] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
    [28] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
)

also jetzt zum problem

ich möchte jetzt dass aus array 1 die comment werte mit dem werten aus array 2 getauscht werden

also so


array 1:
[comment] => CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
array 2:
[1] => test1
endergebniss:
[comment] => test1

ich hoffe mir kann da einer weiter helfen




danke schon mal im vorraus





test php unter :
http://www.soundliners.com/test/edit2.php

test orginal xml :
http://www.soundliners.com/test/imgindex.xml

test neue xml :
http://www.soundliners.com/test/imgindex2.xml
 
Zuletzt bearbeitet:

Stoke

Grünschnabel
Kopier bitte das erste Array aus der Source Ansicht und füg es mit [ code ] tags hier ein, dann kann dir geholfen werden. Ich habe jetzt keine Lust das Array zu formatieren ;)
 

Stoke

Grünschnabel
Also mit den Arrays die du jetzt hast würde das so funktionieren (ungetestet!):

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

Das ist aber aus einigen Gründen nicht sauber. Da dein Array im Gegensatz zum xml Objekt nur eine Ebene hat, muss man davon ausgehen dass die Reihenfolge stimmt. Ist dies nicht der Fall, wird irgendwas schief laufen.
Da solltest du dir vielleicht eine bessere Möglichkeit überlegen.
Weiters ist eine Zahl als Index im $_POST wirklich nicht schön. Nenn die wenigstens comment_1 oder so in der Art ;)
 

djpredator69

Grünschnabel
das klapp vielen vielen dank das ist genau das was ich wollte

also in array 2 steht immer die gleiche reihenfolge wie die comments in array 1

die xlm kann ich nicht ändern die bekomme ich so von einem programm also kann ich blos damit arbeiten

vielen dank noch mals das hilft mir ect weiter
 

djpredator69

Grünschnabel
also vielen dank habs jetzt geschafft hier mein benutzter code

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
$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>";

}

?>


habe aber noch mit einem anderen script ein problem komme sicher wieder zu diesem forum zurück
 

Flex

(aka Felix Jacobi)
Schön wenn du wieder kommst, djpredator69, aber bitte halte dich das nächste Mal an die Netiquette und beachte Groß- und Kleinschreibung, danke!
 

djpredator69

Grünschnabel
hi habe noch ein weiteres problem
also habe jetzt gemerkt dass jedes mal das programm das mir die xml ausgibt beim erstellen neurer daten die xml zuerst löscht

also um dieses problem zu umgehen wollte ich folgender masen vorgehen

nach dem speichern im editor wir eine imgindex.xml im hauptordner gespeichert und eine ander unter
comments/imgindex2.xml

Code:
SimpleXMLElement Object
(
    [album] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [name] => coindesamis
                        )

                    [image] => Array
                        (
                            [0] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [name] => f2011023302
                                        )

                                    [comment] => CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] => coindesamis/f2011023302.jpg
                                    [lURL] => coindesamis/f2011023302.jpg
                                )

                            [1] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [name] => f2011100456
                                        )

                                    [comment] => CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] => coindesamis/f2011100456.JPG
                                    [lURL] => coindesamis/f2011100456.JPG
                                )

                            [2] => SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011110834
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011110834.jpg
                                    [lURL] =&gt; coindesamis/f2011110834.jpg
                                )

                            [3] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011110853
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011110853.jpg
                                    [lURL] =&gt; coindesamis/f2011110853.jpg
                                )

                            [4] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120251
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011120251.jpg
                                    [lURL] =&gt; coindesamis/f2011120251.jpg
                                )

                            [5] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120456
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011120456.jpg
                                    [lURL] =&gt; coindesamis/f2011120456.jpg
                                )

                            [6] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120635
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f2011120635.jpg
                                    [lURL] =&gt; coindesamis/f2011120635.jpg
                                )

                            [7] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416130
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416130.jpg
                                    [lURL] =&gt; coindesamis/f20110416130.jpg
                                )

                            [8] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416131
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416131.jpg
                                    [lURL] =&gt; coindesamis/f20110416131.jpg
                                )

                            [9] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416142
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416142.jpg
                                    [lURL] =&gt; coindesamis/f20110416142.jpg
                                )

                            [10] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416143
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416143.jpg
                                    [lURL] =&gt; coindesamis/f20110416143.jpg
                                )

                            [11] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416164
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416164.jpg
                                    [lURL] =&gt; coindesamis/f20110416164.jpg
                                )

                            [12] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416165
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416165.jpg
                                    [lURL] =&gt; coindesamis/f20110416165.jpg
                                )

                            [13] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416166
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416166.jpg
                                    [lURL] =&gt; coindesamis/f20110416166.jpg
                                )

                            [14] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110416177
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; coindesamis/f20110416177.jpg
                                    [lURL] =&gt; coindesamis/f20110416177.jpg
                                )

                        )

                )

            [1] =&gt; SimpleXMLElement Object
                (
                    [@attributes] =&gt; Array
                        (
                            [name] =&gt; images
                        )

                    [image] =&gt; Array
                        (
                            [0] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011055210
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f2011055210.jpg
                                    [lURL] =&gt; images/f2011055210.jpg
                                )

                            [1] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011110959
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f2011110959.jpg
                                    [lURL] =&gt; images/f2011110959.jpg
                                )

                            [2] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110157500
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110157500.jpg
                                    [lURL] =&gt; images/f20110157500.jpg
                                )

                            [3] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417530
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417530.jpg
                                    [lURL] =&gt; images/f20110417530.jpg
                                )

                            [4] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417541
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417541.jpg
                                    [lURL] =&gt; images/f20110417541.jpg
                                )

                            [5] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417542
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417542.jpg
                                    [lURL] =&gt; images/f20110417542.jpg
                                )

                            [6] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417543
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417543.jpg
                                    [lURL] =&gt; images/f20110417543.jpg
                                )

                            [7] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417554
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417554.jpg
                                    [lURL] =&gt; images/f20110417554.jpg
                                )

                            [8] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417555
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417555.jpg
                                    [lURL] =&gt; images/f20110417555.jpg
                                )

                            [9] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417566
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417566.jpg
                                    [lURL] =&gt; images/f20110417566.jpg
                                )

                            [10] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f20110417567
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; images/f20110417567.jpg
                                    [lURL] =&gt; images/f20110417567.jpg
                                )

                        )

                )

            [2] =&gt; SimpleXMLElement Object
                (
                    [@attributes] =&gt; Array
                        (
                            [name] =&gt; test
                        )

                    [image] =&gt; Array
                        (
                            [0] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011120351
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; test/f2011120351.jpg
                                    [lURL] =&gt; test/f2011120351.jpg
                                )

                            [1] =&gt; SimpleXMLElement Object
                                (
                                    [@attributes] =&gt; Array
                                        (
                                            [name] =&gt; f2011124127
                                        )

                                    [comment] =&gt; CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality

                                    [tURL] =&gt; test/f2011124127.jpg
                                    [lURL] =&gt; test/f2011124127.jpg
                                )

                        )

                )

        )

)


nun zum problem also ich möchte jetzt wenn der editor neu gestartt wird soll der erste wert aus imgindex.xml (<image name="f20110711170">) ausgelesen werden und mit dem ganze array von imgindex.xml wenn der wert da vorhanden ist soll aus diesen array
(<image name="f20110711170"><comment>)das passende comment ausgegeben werden zur weiterverarbeitung
wenn nicht vorhanden soll das comment aus imgindex.xml (<image name="f20110711170"><comment>) ausgelesen werden

wie könnte ich da am besten vorgehen

könnte mir einer bei diesem problem bitte helfen
 
Zuletzt bearbeitet:

Flex

(aka Felix Jacobi)
Könntest du dich bitte an die Netiquette hier halten, wie ich oben bereits erwähnt hatte?
 

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
 

Neue Beiträge

Forum-Statistiken

Themen
272.360
Beiträge
1.558.626
Mitglieder
187.833
Neuestes Mitglied
SirrDansen