Jump to content

xmlMoveNode and xmlPlaceNode


laurens

Recommended Posts

Hi.

I've been scripting for a while and I started my first serious project. A Message Of the Day script.

It's almost done and now I'm trying to make the script close to perfect, but while doing this I came upon a problem. First I'll explain how the script works:

My MOTD script exists of a few files containing code, and a XML file containing all user-submitted text.

The XML has lots of nodes and subnodes and subsubnodes (and so on). For every node a tab get's created with text in it, which can be changed using the script itself.

But because there's so many nodes, I made a simple loop that will try to find all subnodes from top to bottom in every node and create a tab for it. So the tab are in the same order as the nodes are in the XML. Now I could imagine that an admin would like to make a new tab, and wants it to be as the second tab in the panel. This is where the problem lays: there currently is no way to move a XML node up or down inside it's parent node.

That's why I came up with the idea for the following function:

xmlnode xmlMoveNode ( xmlnode NodeToMove, int NewPosition, [ bool relative = false ] )
xmlnode xmlPlaceNode ( xmlnode NodeToMove, xmlnode NewParentNode, int Position )

An explanation about what it does isn't needed in my opinion, the above quotes should give you an idea already.

So what's the possibility of this happening?

Link to comment
  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...