/** encapsulates the content of a delegate into full-fledged HTML (<HTML><BODY> and TITLE)
    usage:
    <pre>
      $db = zetDB('metrics.bib');
      $dis = new BibEntryDisplay($db->getEntryByKey('Schmietendorf2000'));
      new HTMLTemplate($dis);
    </pre>
     * $content: an object with methods
          display()
          getRSS()
          getTitle()
     * $title: title of the page
     */
    function HTMLTemplate(&$content)
    {
        // when we load a page with AJAX
        // the HTTP header is taken into account, not the <meta http-equiv>
        header('Content-type: text/html; charset=' . OUTPUT_ENCODING);
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        echo OUTPUT_ENCODING;
        ?>
"/>
<meta name="generator" content="bibtexbrowser vd4928b33fa2d82db7989e31871c75f917d0b2b8d" />
<?php 
        // if ($content->getRSS()!='') echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="'.$content->getRSS().'&amp;rss" />';
        // we may add new metadata tags
        $metatags = array();
        if (method_exists($content, 'metadata')) {
            $metatags = $content->metadata();
        }
        foreach ($metatags as $item) {
            list($name, $value) = $item;
            echo '<meta name="' . $name . '" property="' . $name . '" content="' . $value . '"/>' . "\n";
        }
        // end foreach
        // now the title
        if (method_exists($content, 'getTitle')) {
            echo '<title>' . strip_tags($content->getTitle()) . '</title>';
        }
        // now the CSS
        echo '<style type="text/css"><!--  ' . "\n";
        if (method_exists($content, 'getCSS')) {
            echo $content->getCSS();
        } else {
            if (is_readable(dirname(__FILE__) . '/bibtexbrowser.css')) {
                readfile(dirname(__FILE__) . '/bibtexbrowser.css');
            } else {
                bibtexbrowserDefaultCSS();
            }
        }
        echo "\n" . ' --></style>';
        ?>
</head>
<body>
<?php 
        if (method_exists($content, 'getTitle')) {
            echo "<div class=\"rheader\">" . $content->getTitle() . "</div>";
        }
        $content->display();
        echo poweredby();
        if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) {
            javascript();
        }
        if (BIBTEXBROWSER_RENDER_MATH) {
            javascript_math();
        }
        ?>
</body>
</html>
<?php 
        //exit;
    }
示例#2
0
 function display()
 {
     // we encapsulate everything so that the output of display() is still valid XHTML
     echo '<div>';
     //echo $this->display_old();
     echo $this->displayOnSteroids();
     echo poweredby();
     echo '</div>';
 }