Monday, November 08, 2010 at 12:00 AM.


on viewTopOfPage () {
		<<4/24/10; 1:37:14 PM by DW
			<<If there's a "user" parameter, then the index file points to that user's index, not the general one.
		<<3/26/10; 9:07:11 AM by DW
			<<Called from the template, usually this just displays title.gif, but if we're rendering a user's static page, and they have their own top-of-page stuff, we use that instead.
			<<<a href="index"><%river2Suite.loadImage ("title.gif")%></a><br /><br />
	local (pta = html.getpagetableaddress (), indexfname, toppagetext);
	<<scratchpad.toppageparams = pta^ //debugging
	bundle { //set indexfname
		if defined (pta^.river2.staticFname) {
			indexfname = pta^.river2.staticFname} //see river2Suite.static.buildOnePage
		else {
			indexfname = "index";
			if pta^.adruser != nil { //4/24/10 by DW
				indexfname = indexfname + "?user=" + nameof (pta^.adruser^)}}};
	bundle { //set toppagetext
		local (flnotset = true);
		if pta^.adruser != nil {
			if pta^.adruser^.prefs.static.topPageText != "" {
				toppagetext = string (pta^.adruser^.prefs.static.topPageText);
				flnotset = false}};
		if flnotset {
			toppagetext = river2Suite.loadImage ("title.gif")}};
	return ("<a href=\"" + indexfname + "\">" + toppagetext + "</a>")}
<<bundle //test code
	<<html.setpagetableaddress (@scratchpad.toppageparams)
	<<webbrowser.displaytext (viewTopOfPage ())

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.