[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: duff link to functions in manual
In article <b27ba05158.John@xxxxxxxxxxxxxxxxxxxxxx>, John Rickman
<rickman@xxxxxxxxxxxxx> wrote:
> . It could really use some form of generic search. You can use the
> Google or DuckDuckGo search engines to do this with just a few line of
> html by directing the search at just the manual pages.
For RISC OS the best bet is usually duckduckgo.com/lite/ (or
...go.com/html/') but these have an inherent problem - a lack of URL
variables! You need a little jiggery pokery with a PHP script to enable a
DDG site search FORM on your site to be free of Javascript.
Imagine you want to search for 'wrap' in the torrens.org manual.
The URL you need to generate is:
http://duckduckgo.com/lite/?q=site:stronged.torrens.org+wrap
Try it.
To make a form construct that string without Javascript, you have to
capture 'wrap' in your own form, append or prepend the 'site:stro...' bit
in your own PHP script and then submit the full search from that script.
It's easier than it sounds.
The HTML form on the site could be:
<form method="post" id="search" action="handlesearch.php">
<input type="hidden" name="site" value="stronged.torrens.org">
<input type="text" name="query" maxlength="255" size="25">
<input type="submit" value="Search StrongED Manual" />
</form>
And the file handlesearch/php just needs to be this:
<?php
$s = "site:" . $_POST['site'];
$q = $_POST['query'];
$action="http://duckduckgo.com/lite/?q=" . $s . "+" . $q;
header("Location: $action");
?>
(This is how the RISC OS search works over at www.timil.com/riscos
by prepending 'risc-os+' to the search term.)
You can test the search form created with the exact code above right
here: http://timil.com/temp/search.htm
HTH.
--
Tim Hill
--------
Find an event to attend at:
http://timil.com/riscos/calendar/
Mimemap and other stuff:
http://timil.com/riscos/