Bonjour a tous...
Après avoir fait le tour de pas mal de site, j'ai une question que je me pose quand à l'utilisation de simplexml. Si j'ai bien compris, simplexml est censé juste parser, et donc on ne peut pas définir un n½uds xml à partir duquel on va modifier son fichier !
En fait j'utilise cette méthode ainsi pour modifier un xml, et lui ajouter un n½uds :
if(isset($_POST['xml4']))
{
$root = simplexml_load_file("xml/gastronomie.xml");
$account = $root->addChild("Image");
$account->addAttribute("url","".$url."");
$account->addAttribute("thumbs","images/thumbs/".$photo1."");
$account->addchild("ButtonText","<![CDATA[SUPPORT SWF ]]>");
$account->addChild("WaitTime","3");
$root->asXml("xml/gastronomie.xml");
}
Sa me rajoute bien ma ligne dans mon xml! Malheureusement, je me rends compte qu'il me la rajoute après mon n½uds parent qui est nommé Images.
Voila la structure de mon xml :
<?xml version="1.0" encoding="utf-8"?>
<BannerRotator>
<RandomTransition>true</RandomTransition>
<UseTransition>VerticalBar|Cube3D|HorizontalStore|LeftRightBlur|MosaicVerticalCube|RightLeftBlur|VerticalBar|VerticalStore|VerticalStretch|HorizontalStretch|Spiral|SquareTurn|Dot|Paint|Alpha</UseTransition>
<AutoPlay>true</AutoPlay>
<TimerOnClick>5</TimerOnClick>
<MenuPosition>right</MenuPosition>
<Fullscreen>true</Fullscreen>
<BannerWidth>230</BannerWidth>
<BannerHeight>407</BannerHeight>
<Randomize>false</Randomize>
<ShowButton>false</ShowButton>
<BlurTextBackground>true</BlurTextBackground>
<AutoSlide>true</AutoSlide>
<ShowWaitLine>false</ShowWaitLine>
<KeepOriginalSize>false</KeepOriginalSize>
<ButtonBarColor>0x000000</ButtonBarColor>
<ResizeToFit>false</ResizeToFit>
<ButtonWidth>140</ButtonWidth>
<ButtonHeight>43</ButtonHeight>
<ButtonForeColor>0xffffff</ButtonForeColor>
<ButtonBackColor>0x000000</ButtonBackColor>
<ButtonGlowColor>0xF45353</ButtonGlowColor>
<ButtonActivatedTextColor>0xffffff</ButtonActivatedTextColor>
<ButtonActivatedBackColor>0x951C1D</ButtonActivatedBackColor>
<ButtonTextAlign>center</ButtonTextAlign>
<ButtonTextSize>15</ButtonTextSize>
<ButtonNoFlip>false</ButtonNoFlip>
<Images>
<Image url="images/gastronomie/homard.jpg" thumb="thumbs/image_3.jpg">
<ButtonText><![CDATA[SUPPORT SWF ]]></ButtonText>
<WaitTime>3</WaitTime>
<Click url="homard.php" target="_parent"/>
</Image>
</Images>
</BannerRotator>
Comment donc pourrai-je rajouter mon n½uds dans Images et non pas à l'extérieur de celui ci ?J'espère que je me suis fait comprendre.
Dans l'attente d'une éventuelle réponse, mais d'or et déjà merci d'avance pour vos réponses ...