Hello,
Still a bit thin on the ground though currently I'm looking at an XPATH solution, here is an idea?
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<templates>
<!-- a very typical example of a webpage structure -->
<template id="page">
<template id="header" parent="page">
<template id="searchbox" parent="header" />
</template>
<template id="body" parent="page">
<template id="leftside" parent="body">
<template id="news" parent="leftside" />
<template id="polls" parent="leftside" />
<template id="signon" parent="leftside" />
</template>
<template id="rightside" parent="body">
<template id="breadbrumbs" parent="rightside" />
<template id="content" parent="rightside">
<template id="menu" parent="content" />
<template id="document" parent="content" />
</template>
</template>
</template>
<template id="footer" parent="page" />
</template>
</templates>
The XML is kept simple at the moment, using attributes for labeling but using nodes shouldn't be a problem, ie
Code:
...
<template id="blahblahblah" parent="blahblahblah">
<url>segment-template.tpl</url>
<handler>../handlers/segment-controller.php</handler>
...
</template>
...
Some script, which I might add I'm embarrassed to post

PHP Code:
$dom = new DomDocument;
$dom -> load( 'recursion.xml' );
$xp = new DomXPath( $dom );
$fragments = $xp -> query( "//template[@id='page']" );
// DOMNodeList
$id = $fragments -> item( 0 ) -> getAttribute( 'id' );
$tmp[$id] = array();
$fragments = $xp -> query( "//template[@parent='".$id."']" );
foreach( $fragments as $fragment ) {
$node = $fragment -> getAttribute( 'id' ); echo( $node.'<br />' );
}
Would certainly welcome suggestions from SleapEasy btw (hint hint)
Bookmarks