Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.macros.searchThisSite
on searchThisSite (buttontext="Search", flThisSiteOnly=true, thisSiteOnlyCheckText="This site only") {
<<Changes
<<8/30/02; 5:36:52 PM by JES
<<Created. Render a search box, if the community server supports search engine indexing. If the community server does not do search engine indexing, return the empty string.
bundle { //find reasons not to add the search box
if not defined (radio.data.myCommunity.flHasSearch) {
return ("")};
if not radio.data.myCommunity.flHasSearch {
return ("")};
if not defined (user.radio.prefs.usernum) {
return ("")}};
local (htmltext = "");
on add (s) {
htmltext = htmltext + s;};
local (searchurl = radio.data.myCommunity.searchPageUrl);
add ("<form method=\"get\" action=\"" + searchurl + "\"><nobr>");
add ("<input type=\"text\" name=\"q\" size=\"13\" value=\"\"> ");
add ("<input type=\"submit\" value=\"Search\">");
add ("</nobr>");
if flThisSiteOnly {
add ("<input type=\"hidden\" name=\"searchThisSiteOnly\" value=\"true\">")}
else { //add a checkbox the reader can use to search only this site -- default checked
add ("<br /><input type=\"checkbox\" name=\"searchThisSiteOnly\" value=\"true\" checked> " + thisSiteOnlyCheckText)};
add ("<input type=\"hidden\" name=\"siteUrl\" value=\"" + radio.weblog.getUrl () + "\">");
add ("<input type=\"hidden\" name=\"usernum\" value=\"" + user.radio.prefs.usernum + "\">");
add ("</form>");
return (htmltext)}
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.