Original idea instructions by Craig Small
<csmall@eye-net.com.au>
. Some minor changes by Alex
Barkov <bar@mnogosearch.org>
.
It is often required to allow for different languages which means different search.htm files depending on what language users have set in their browser.
Further installation should be done in three steps.
Installing several templates.
The general idea is to have one search.php or search.cgi file and then many search.[language].htm files. You also have a search.htm file (usually a symlink to search.en.htm) for the default.
If the name of the script is search.en.php (or search.en.cgi) then both CGI and PHP front-ends will be looking for /somewhere/etc/search.en.htm assuming that /somewhere/etc/ is /etc/ directory of DataparkSearch installation.
You would then populate /somewhere/etc/ with all the search.htm files so /somewhere/etc has:
Installing front-ends
Create a directory and put search.cgi or search.php there (along with the include files if you want, but I fiddle with the php include_path and put them elsewhere).
Then setup the symlinks:
Or in the case of PHP front-end:
Configuring Apache
Then you need to make apache understand what weirdness you are doing here. So you need to get negotiation happening and some magic with the indexes. I used .htaccess file but you could stick it in the apache config proper.
AddLanguage en .en AddLanguage pl .pl AddLanguage ru .ru DirectoryIndex search search.cgi (or search.php) Options FollowSymlinks MultiViews
You type url http://myhost/mydir/search no slash at end !!
Your browser says "I like english (well language negotiation en) "
Apache finds search.en.cgi (DirectoryIndex gives search, MultiViews gives the en.cgi)
The SCRIPT_FILENAME which is used in both search.cgi and search.php is somepath/search.en.cgi
Note: Most other variables will give the wrong result, either search or search.cgi)
Your hack in config.inc means you will use search.en.htm.
So what happens if the user wants, say, German? Well there is no search.de.cgi (search.de.php) so the first bit of DirectoryIndex fails, so it tries the second one, search.php OK, they get the page in English, but it's better than a 404.
This does work, you may need some more apache fiddling to get negotiation to work because I am testing this on a server that already has it setup, so I may have missed something.
You may get some language negotiation problems caused by:
Dumb caches that don't follow standards
Dumb versions of browsers that don't follow standards
Dumb users fiddling with language settings and putting weird stuff in.
The apache team is working on some workarounds for most of these, if possible. For a reasonably heavily used web site you can expect an email about it once a week or so.