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

on bgImageRef (imageSpec="", pageTable=nil) {
	<<Friday, January 02, 1998 at 2:17:05 AM by PBS
		<<Returns the url of the specified image.
		<<Use this in your #pageheader attribute.
			<<{"<body " + bgImageRef () + " alink=\"#008000\" bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#00008B\" vlink=\"#800080\">"}
		<<By default, the image is specified by the #background directive.
			<<#background -> "myBackgroundImage"
		<<If the specified image is the empty string, return an empty string.
	local (imageTable);
	if pageTable == nil {
		pagetable = html.getPageTableAddress ()};
	if imageSpec == "" { //get the imageSpec from the page table
		try {
			imageSpec = pageTable^.background}};
	if imageSpec == "" {
		return ("")};
	if imageSpec contains "/" { //It's not an imageRef-style reference
		return ("background=\"" + imageSpec + "\"")};
	if imageSpec contains "." {
		local (lowerspec = string.lower (imageSpec));
		if (lowerspec endsWith ".gif") or (lowerspec endsWith ".jpg") {
			return ("background=\"" + imageSpec + "\"")}};
	<<Get image data table for this image.
	imageTable = html.getImageData (imageSpec, pageTable);
	return ("background=\"" + imageTable.url + "\"")}

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.