I'm trying to set some variables to update an XML file on save. File upload->xml->flash->frontend. Here is my code so far
Code: Select all
$file = '../portfolio/images.xml';
$xml = simplexml_load_file($file);
foreach($xml->imageSet[0] as $image):
if($image->attributes()->rel != ""):
$image->attributes()->test = 'this is just a test';
endif;
endforeach;
file_put_contents($file, $xml->asXml());
Code: Select all
<imagesXML>
<imageSet titleEn="overview" titleFr="survol">
<image imageName="../../uploads/bannerimageen/4-promoimage_en.jpg" captionEn="/en/page.php?p=mcalendar" captionFr="fr/page.php?p=ghfd" rel="hprb" test="" />
<image imageName="../../uploads/bannerimagefr/4-promoimage_fr.jpg" captionEn="/en/page.php?p=magelendar" captionFr="/fr/page.php?p=magealendar" rel="hprb" test="" />
</imageSet>
<imagesXML>
Warning: file_put_contents(../portfolio/images.xml) [function.file-put-contents]: failed to open stream: Permission denied in /var/www/vhosts/BLANK/httpdocs/admin/editbanner.php on line 49
So would anybody be able to help me update and save those attributes? Thanks!