function LocalLibReferencePage(&$ref, $lib, $translation, $rel_path = '../../')
 {
     global $LANGUAGES;
     $lang = 'en';
     $this->filepath = "distribution/libraries/{$lib}/" . $ref->name();
     $title = $ref->title() . "\\ {$lib} \\ Language (API) \\ Processing 2+";
     $xhtml = new xhtml_page(TEMPLATEDIR . 'foundation-template.local.html');
     $xhtml->set('header', '<a href="http://processing.org/" title="Processing.org"><div class="processing-logo" alt="Processing cover"></div></a>');
     $xhtml->set('title', $title);
     $xhtml->set('bodyid', 'Library-ref');
     $xhtml->set('navigation', local_nav('Libraries', $rel_path));
     $piece = new xhtml_piece(TEMPLATEDIR . 'foundation-template.reference.item.html');
     $xhtml->set('content_for_layout', $piece->out());
     $xhtml->set('reference_nav', library_nav($lib));
     $xhtml->set('language_nav', language_nav($lang));
     foreach ($translation->attributes as $key => $value) {
         $xhtml->set($key, $value);
     }
     foreach ($translation->meta as $key => $value) {
         $xhtml->set($key, $value);
     }
     $xhtml->set('content', $ref->display());
     $xhtml->set('updated', date('F d, Y h:i:sa T', filemtime(CONTENTDIR . '/' . $ref->filepath)));
     $xhtml->set('relpath', $rel_path);
     $this->xhtml = $xhtml;
 }
        $link = $xpath->getNode($item['xpath'] . "/link[{$li}]");
        while ($link !== false) {
            $items[$i]['links'] .= "<a href=\"{$link[attributes][href]}\">{$link[textParts][0]}</a><br />";
            $li++;
            $link = $xpath->getNode($item['xpath'] . "/link[{$li}]");
        }
        if (count($items[$i]['links']) > 0) {
            $items[$i]['links_title'] = 'Links:<br />';
        }
        $html .= apply_template($items[$i], BASEDIR . '/templates/template.curated.item.html');
        $i++;
    }
}
$template = BASEDIR . '/templates/template.html';
$templatepiece = BASEDIR . '/templates/template.test.html';
$page = new xhtml_page($template);
$page->set('title', 'Testing');
$piece = new xhtml_piece($templatepiece);
$page->set('content', $piece->out());
$page->set('replaceme', $html);
$fp = fopen(BASEDIR . '/testout.php', 'w');
fwrite($fp, $page->out());
fclose($fp);
echo $page->out();
echo '<pre>';
print_r($items);
echo '</pre>';
?>

	<a href="javascript:MM_openBrWindow('<!--*-->location<!--*-->','<!--*-->name<!--*-->','status=yes,scrollbars=<!--*-->scroll<!--*-->,resizable=<!--*-->resize<!--*-->,width=<!--*-->width<!--*-->,height=<!--*-->height<!--*-->')" title="">
	<img src="<!--*-->img_file<!--*-->" alt="<!--*-->img_alt<!--*-->" title="<!--*-->img_title<!--*-->" class="curatedImg" /></a><br />