Namazu-users-en(old)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Support for {idxname} in namazu.cgi
- From: Earl Hood <ehood@xxxxxxxxxxxxxxxxx>
- Date: Wed, 25 Oct 2000 10:57:32 -0700
- X-ml-name: namazu-users-en
- X-mail-count: 00027
I recently setup namazu for searching MHonArc mail archives at my
current place of employment. One thing I wish the namazu.cgi program
would support in its templates is "{idxname}": expands to the name of
the index.
My goal was to preserve the context of a given archive for the
search pages (even when they selected the help link) so the user
does not have to select an archive via select list each time.
A work-around was to use JavaScript to get what I want. IMO, I
do not like this since the client must have javascript support and
have it enabled. To give you an example of what was done, here is
part of my NMZ.head file:
...
<script>
function getArgs() {
var args = new Object();
if (location.search.length <= 1) return args;
var pairs = location.search.substring(1).split("&");
for (var i=0; i < pairs.length; ++i) {
var pos = pairs[i].indexOf('=');
if (pos < 0) {
args[pairs[i]] = "";
continue;
}
args[pairs[i].substring(0,pos)] = unescape(pairs[i].substring(pos+1));
}
return args;
}
var queryArgs = getArgs();
var idxname = queryArgs["idxname"];
</script>
</head>
<body lang="en">
<script>
document.writeln("<h1><a href=\"/archives/" + idxname +"/\">" +
idxname + " archive</a> search</h1>");
</script>
<form method="get" action="{cgi}">
<p><strong>Search String:</strong>
<input type="text" name="query" size="40">
<input type="submit" name="submit" value="Search!">
<script>
document.writeln("<input type=\"hidden\" name=\"idxname\" value=\"" +
idxname + "\">");
document.writeln("<a href=\"{cgi}?idxname=" + idxname +
"\">[How to search]</a><br>");
</script>
...
In sum, the page extracts the idxname from the query string itself and
then uses document.writeln() calls to output the HTML that I want to
include the idxname in. The nice thing about the final result is that
when the results page is displayed or users goto the "How to search"
link, they automatically stay within the context of the mail archive
they were reading.
The use of javascript can be avoided if {idxname} was supported by the
CGI program directly.
--ewh
----
Earl Hood | University of California: Irvine
ehood@xxxxxxxxxxxxxxxxxx | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME