/**
  * constructor; add js / css; set up listener
  *
  * @author Andy Bennett
  */
 function __construct()
 {
     //parent::__construct();
     Assets::instance()->add_css('/cache/css/forum');
     Assets::instance()->add_javascript('/cache/js/forum');
     Event::add('forum.render', array('steamforum_listeners', 'render'));
     $this->argv = Router::$arguments;
     $this->current_page = "forum";
     // Remove the first argument which is always the name of the current page
     if (is_array($this->argv)) {
         $this->current_page = array_shift($this->argv);
     } else {
         $this->argv = array();
     }
     // Work out the base url for links - TODO: This needs to be generalised as its currently itim specific
     $this->base_url = sitemap_helper::get_base() . "/" . $this->current_page;
 }
<?php

echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
?>
<root>
	<items>
<?php 
// var_dump($nodes); exit;
$type = sitemap_helper::get_type();
if ($nodes->count()) {
    $level = $nodes->current()->{$level_column};
    $first = TRUE;
    $open = array('root', 'items');
    foreach ($nodes as $node) {
        if ($node->{$level_column} > $level) {
            echo "\n";
            // nothing
        } else {
            if ($node->{$level_column} < $level) {
                $l = $level - $node->{$level_column} + 1;
                for ($i = 0; $i < $l; $i++) {
                    if ($i) {
                        echo str_pad('', $node->{$level_column} + ($l - $i - 1), "\t", STR_PAD_LEFT);
                    }
                    echo '</' . array_pop($open) . '>' . "\n";
                }
            } else {
                if (!$first) {
                    echo '</' . array_pop($open) . '>' . "\n";
                }
            }