Hi,
ich bin totaler PHP Anfänger und neu hier. Nun gleich mal meine erste Frage.
Ich habe eine xml Datei deren Inhalt ich mittels PHP bearbeiten möchte.
Die xml Datei sieht wie folgt aus
PHP-Code:
<?xml version="1.0" encoding="utf-8"?>
<cu3er>
<settings>
<prev_button>
<defaults round_corners="5,5,5,5"/>
<tweenOver tint="0xFFFFFF" scaleX="1.1" scaleY="1.1"/>
<tweenOut tint="0x000000"/>
</prev_button>
<prev_symbol>
<tweenOver tint="0x000000"/>
</prev_symbol>
<next_button>
<defaults round_corners="5,5,5,5"/>
<tweenOver tint="0xFFFFFF" scaleX="1.1" scaleY="1.1"/>
<tweenOut tint="0x000000"/>
</next_button>
<next_symbol>
<tweenOver tint="0x000000"/>
</next_symbol>
</settings>
<slides>
<slide name="slide1">
<url>http://www.php.de/images/slide_1.jpg</url>
</slide>
<!-- changing transition between first & second slide -->
<transition num="3" slicing="vertical" direction="down"/>
<slide>
<url>http://www.php.de/images/slide_2.jpg</url>
</slide>
<!-- changing transition between second & third slide -->
<transition num="4" direction="right" shader="flat"/>
<slide>
<url>http://www.php.de/images/slide_3.jpg</url>
</slide>
<!-- transitions properties defined in transitions template -->
<slide>
<url>http://www.php.de/images/slide_4.jpg</url>
</slide>
<transition num="6" slicing="vertical" direction="up" shader="flat" delay="0.05" z_multiplier="4"/>
<slide>
<url>http://www.php.de/images/slide_5.jpg</url>
</slide>
</slides>
</cu3er>
Nun möchte ich z.B mittels PHP die url von slide 1 ändern. Dazu habe ich folgenden kleinen PHP Code.
PHP-Code:
<?php
$cu3er = simplexml_load_file("config.xml");
$cu3er->slides->slide->slide1->url ="webspell/images/slide_1.jpg";
file_put_contents("config.xml", $cu3er->asXML());
?>
Nun ändert er allerdings nicht die URL sondern für praktisch einen neuen Parameter in <slide> ein.
PHP-Code:
<slide name="slide1">
<url>http://www.php.de/images/slide_1.jpg</url>
<slide1><url>webspell/images/slide_1.jpg</url></slide1></slide>
Was habe ich falsch gemacht?