I have an XML file representing categories like this
-
<?xml version='1.0' encoding='utf-8' ?>
-
<bank>
-
<img>
-
<src>img/GF0813-1_thumb.jpg</src>
-
<title>classicΙ</title>
-
<caption>Click here</caption>
-
<link>main.php?page=2&id=125</link>
-
<target>_self</target>
-
</img>
-
<img>
-
<src>img/PBE0720008_thumb.jpg</src>
-
<title>BULLETS</title>
-
<caption>Click here</caption>
-
<link>main.php?page=2&id=117</link>
-
<target>_self</target>
-
</img>
-
</bank>
-
where each <img></img> represents a category which has an image (<src>), title (<title>), caption (<caption>), link and target of that link.
Now when I add a category its easy to open the xml like an ordinary file and add the corresponding <img> at the end, but when I delete/modify a category I have to check where the corresponding <img></img> exists (each category/<img> has a unique id going into the <link>) and modify that how can I do it? (My initial idea involves using explode with </img>, is there a better way to handle xml through PHP?)