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?