====== autosearch Plugin ======
---- plugin ----
description: Handle s non-existent pages by redirecting to index sub-page if available; otherwise showing sub-pages and/or displaying Search Results
author : Ahmet Sacan
email : ahmet@ceng.metu.edu.tr
type : action
lastupdate : 2007-02-07
compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky
depends : indexmenu
conflicts :
similar :
tags : redirect, search, namespace
downloadurl: http://sacan.biomed.drexel.edu/ahmet/lib/exe/fetch.php?rev=&media=software:dokuwiki:autosearch.zip
sourcerepo :
bugtracker :
donationurl:
----
If the site visitor requests a non-existent page, autosearch pluging will kick in to show the following:
- Redirect to the index sub-page if one exists. For example, if '':folder:index'' page exists but '':folder'' page does not exist, and a visitor requests the '':folder'' page, he/she will be automatically redirected to '':folder:index'' page. The names of index subpages can be specified in the configuration manager.
- If no index subpage is available, show the list of subpages (requires [[indexmenu]] plugin) and also the results of searching the requested page title. The search results is useful especially when you move your pages around and static links from outside world into your site become obsolete.
Information and download:
* [[http://www.ceng.metu.edu.tr/~ahmet/Wiki/software/dokuwiki/autosearch|Details and Download]] FIXME \\
* [[http://sacan.biomed.drexel.edu/ahmet/index.php?id=software:dokuwiki:autosearch|Alternate Details and Download]] (if the link above does not work).
======= Discussion =======
zip file is not ok at all:
* Create folder ''autosearch'', open zipfile with an unzipper, select the files in the folder and unzip only these to your created folder.
* In Linux, first create the autosearch directory ("mkdir autosearch") in the same directory of zip file, then unzip it with "unzip autosearch.zip". When it ask to overwrite the autosearch directory, say "n". --- //[[samuele@samuele.netsons.org|Samuele Tognini]] 2008/08/27 17:46//
===== Indexmenu compatibility =====
You need to apply this patch to get latest [[plugin:indexmenu]] releases work:
diff -urN /tmp/autosearch/action.php ./autosearch/action.php
--- /tmp/autosearch/action.php 2007-07-03 12:15:00.000000000 +0200
+++ ./autosearch/action.php 2008-08-27 18:40:35.000000000 +0200
@@ -41,7 +41,7 @@
die();
}
}
- if($this->getConf('pagelist') && is_dir(dirname(wikiFN("$ID:dummy"))) &&
$indexmenu =& plugin_load('syntax', 'indexmenu')){
+ if($this->getConf('pagelist') && is_dir(dirname(wikiFN("$ID:dummy"))) &&
$indexmenu =& plugin_load('syntax', 'indexmenu_indexmenu')){
$handled = $indexmenu->handle("{{indexmenu>$ID#2|js#default}}",null,nul
l,$this);
$dummy_renderer = (object) array('doc'=>'');
$indexmenu->render('xhtml',$dummy_renderer, $handled);
===== Correct start pages =====
I made a few alterations to correctly handle start pages [[config:startpage|named as configured]] (''start'' by default) instead of hard-coded ''index'':
diff -ur autosearch.old/action.php autosearch/action.php
--- autosearch.old/action.php 2014-03-31 16:54:00.662421400 +0100
+++ autosearch/action.php 2014-03-31 16:53:11.133588500 +0100
@@ -23,6 +23,7 @@
array());
}
function handle_act(&$e, $param){
+ global $conf;
global $ID;
if($e->data != 'show' || strpos($ID,'talk:')===0) return;
@@ -36,6 +37,9 @@
foreach($index_pages as $index){
if($index == '@subpage_with_same_name')
$index = noNS($ID);
+ if($index == '@start_page')
+ $index = $conf['start'];
+
if(is_file(wikiFN("$ID:$index"))){
header("Location: ".wl("$ID:$index", $perm < AUTH_CREATE ? "" : "auto_search_indexed=1"));
die();
diff -ur autosearch.old/conf/default.php autosearch/conf/default.php
--- autosearch.old/conf/default.php 2009-05-20 17:50:38.000000000 +0100
+++ autosearch/conf/default.php 2014-03-30 23:40:27.858605200 +0100
@@ -1,4 +1,4 @@
array('index','home','@subpage_with_same_name'));
+ '_choices' => array('@start_page','@subpage_with_same_name'));
$meta['pagelist'] = array('onoff');
$meta['search'] = array('onoff');
[[pinguim.ribeiro@gmail.com|Fernando Ribeiro]]