A patch/plugin for
UseModWiki version 0.92 (April 21, 2001)
Seems to work for version 1.00 as well.
This patch saves referer (I am sticking with T. Berners Lee spelling ;-) ) pagenames every time a valid page is browsed. Then allows to produce a referer bar with links to referrer and "referees" (for lack of a better term). If you don't understand what I am talking about see for your self at http://spooky.econ.umn.edu/cgi-bin/testwiki.pl
(dead link as of 10 march 2003, redirects to http://localhost/FoxServ/missing.htm) (see: [http://spooky.econ.umn.edu/cgi-bin/testwiki.pl at archive.org])
It would be a very nice add-on to large traffic sites such as the wikipedia. On smaller site it is a cool feature. Use it with stylesheets for best results
Please place comments and questions below in the appropriate comments section
Version
0.2 (Beta) 12/12/2001
Release notes
I am still not very confident with Perl and I am positive that some of the coding choices are not optimal/right/etc...but they work so far on my test site. I urge you to let me know what is wrong and how it can be improved. In particular I had no clue about where to place the code and I had to play by ear. Since I didn't want to mess up too much with wiki.pl (I'd like to keep it as clean as possible) I have decided to write it as an external file (there are 160 lines of code) and not to mess with wiki.pl subroutines (even though it would have been a more appropriate choice). You can read some comments I wrote while designing this thing at
ElMoro/GetReferersBarComments
Files Included
- These two last pages pop-up the request to save them as file and output is actual file in wiki-decoration html. Anybody can fix these names so that the pages can be actually viewed, not downloaded? -- UrbanSheep
- As a quick fix, try using the 'edit page' link to get the original data for cut/paste out of the textarea, of course, don't save the wiki page. -- Anon
INSTALLATION
Follow these simple steps. (N.B. this is not guaranteed to be optimal)
- copy this file in your cgi-bin dir (the same directory where your wiki.pl is)
- add the following line inside sub DoCacheBrowse after line $idFile = &GetHtmlCacheFile($query);
&GetReferences($query);
- add the following line right before $BrowseCode is assigned i.e. before the comment # == Normal page-browsing
do "getreferersbar.pl";
- add the following line to wiki.pl inside sub BrowsePage, between rows containing $MainPage =~ s|/.*||; and the row containing $fullHtml = &GetHeader($id, &QuoteHtml?($id), $oldId);
&GetReferences($OpenPageName);
- place your referer links where desired. For example I like to place it as follows. Towards the end of subroutine &BrowsePage before $fullHtml .= &GetFooterPage? the following line:
$fullHtml .= &GetReferersBar;
- (Optional) For best results, you should also add the included stylesheet ref.css to your data directory (or import its contents to your existing stylesheet. If you choose to do so, you have to indicate the path to the file in the config file, configuration variable (e.g. $StyleSheet = "my_data_dir/ref.css")
- This distribution also includes makeref.pl a simple perl file that generates appropriate usable stylesheets. With appropriate modification you can obtain shades of colors different than grey.
HISTORY
0.2 (12/11/2001)
- Placed all global variables within the file to minimize installation instructions
- Fixed some sorting problem
- The code now saves referers when cache is on
0.1
KNOWN PROBLEMS
- I would like to save referer's info upon (new) page creation. I haven't looked into that yet
- when UseCache=1 and the page is pulled from the cache, it will not display an updated list of referers and referees (I don't view this as a bug).
- when UseRefCss?=1 The referers "rank" for computing backgrounds is based on number of hits first then on alphabetical value of the referer pagename. Different referers will display a different background (depending on such rank) even if they have the same number of hits. I actually view this as a feature not a bug (but I understand you may disagree)
Comments - Questions
- Make the colours less saturated. I think the table will be more appealing if you started from a pink and faded to white, instead of from saturated red. That's too distracting. MeatBall:ContentOverForm.
- I agree that the example doesn't look quite right. The distributed version actually uses shades of gray, not red. I distributed a simple program (makeref.pl) that generates stylesheets with different colors. As for MeatBall:ContentOverForm, you can set UseRefCss?=0 to have output in plain text so you can forget about colors and css :-). --ElMoro