Handle Browse

We have been asked to retrieve a page from the database and transmit it to the user's browser as HypertextMarkupLanguage. We begin by printing those parts of the page that depend only on the title.

  sub HandleBrowse {
    $title = $CookedInput{browse};
    print <<EOF ;
	<h1>$LogoImage <a href="$ScriptUrl\?search=$title">$title<\/a><\/h1>

We retrieve the page as a collection of strings bound to StandardKeys. From these strings we retrieve the text of the page as originally typed. We convert this to html in two steps. First we substitute html escape codes for characters that might otherwise have an unwanted html meaning. (But, oops, with in-place hyperlinks this should be moved inside PrintBodyText.) Then we print that as the body of the page adding our own html tags as we see fit.

    %old = &RetrievePage($title);
    $_ = $old{text};

We wind up the page by adding a couple of standard links after a horizontal rule. Edit Text recalls this page, but formatted as an html form for revising it. Find Page retrieves a standard page, presumably with useful references, and possibly a SearchForm which, if present, will be preloaded with the title of this page. We also report the date we saved with this page the last time it was edited.

    print <<EOF ;
	<a href="$ScriptUrl\?edit=$title">Edit Text<\/a> of this page 
	(last edited $old{date})<br>
	<a href="$ScriptUrl\?FindPage&value=$title">Find Page<\/a> by browsing or searching<br>


Last edited April 18, 1996
Return to WelcomeVisitors