PHP+XML changing node order

XeonBlade

New Member
I've made a simple news script that saves articles to rss which then gets used on the Character Generator Newsticker on TV, the problem is that the CG plays the nodes starting from the top of the rss file.now the xml looks like this:\[code\]<?xml version="1.0" ?><rss version="2.0"><channel><title>News</title><link>website.com</link><description>News</description><language>ar-sa</language><item><title>Headline 1</title><description>Headline one the news this hour</description></item><item><title>Headline 2</title><description>Fire here flooding over there</description></item><item><title>Headline 3</title><description>Fire here flooding over there</description></item></channel></rss>\[/code\]What i would like todo is have an option to move articles up and down the xml file, so instead of having "Headline 3" third in the list i would like to move it up to be first.I know with C# you can do this using:\[code\]XElement node = ...get the element...//Move upif (node.PreviousNode != null) {node.PreviousNode.AddBeforeSelf(node);node.Remove();}//Move downif (node.NextNode != null) {node.NextNode.AddAfterSelf(node);node.Remove();\[/code\]Anyone have an idea how i can do this in PHP?Thanks!
 
Back
Top