]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/display.php
Jeff's hacks II.
[SourceForge/phpwiki.git] / lib / display.php
1 <?php
2 // display.php: fetch page or get default content
3 // calls transform.php for actual transformation of wiki markup to HTML
4 rcs_id('$Id: display.php,v 1.10 2001-09-18 19:16:23 dairiki Exp $');
5
6 require_once('lib/Template.php');
7 require_once('lib/transform.php');
8
9 function displayPage($dbi, $request) {
10    $pagename = $request->getArg('pagename');
11    $version = $request->getArg('version');
12    
13    $page = $dbi->getPage($pagename);
14    if ($version) {
15       $revision = $page->getRevision($version);
16       if (!$revision)
17          NoSuchRevision($page, $version);
18    }
19    else {
20       $revision = $page->getCurrentRevision();
21    }
22
23    $template = new WikiTemplate('BROWSE');
24    $template->setPageRevisionTokens($revision);
25    $template->replace('CONTENT', do_transform($revision->getContent()));
26    echo $template->getExpansion();
27    flush();
28    $page->increaseHitCount();
29 }
30
31 // For emacs users
32 // Local Variables:
33 // mode: php
34 // c-file-style: "ellemtel"
35 // End:   
36 ?>