DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autosearch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:autosearch [2009-04-19 22:53] – email updated samueleplugin:autosearch [2023-10-30 22:58] (current) Klap-in
Line 1: Line 1:
-====== autosearch plugin ======+====== autosearch Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: handles non-existent pages by redirecting to index sub-page if available; otherwise showing sub-pages and/or displaying Search Results+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 author     : Ahmet Sacan
 email      : ahmet@ceng.metu.edu.tr email      : ahmet@ceng.metu.edu.tr
 type       : action type       : action
 lastupdate : 2007-02-07 lastupdate : 2007-02-07
-compatible : 2007-02-07+compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky
 depends    : indexmenu depends    : indexmenu
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : non-existent, redirect, list subpages+tags       : redirect, search, namespace 
 + 
 +downloadurl: http://sacan.biomed.drexel.edu/ahmet/lib/exe/fetch.php?rev=&media=software:dokuwiki:autosearch.zip 
 +sourcerepo :  
 +bugtracker :  
 +donationurl:
 ---- ----
  
-[[http://www.ceng.metu.edu.tr/~ahmet/Wiki/software/dokuwiki/autosearch|Details and Download]] 
  
 +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 ======= ======= Discussion =======
-The download archive on his site is broken, as is the CAPTCHA. -- [[abr.programmer@gmail.com|abr]] 
  
-The download was an invalid zip file as of 12-06-07. No CAPTCHA required, by the way. -- JR +zip file is not ok at all:  
-> It's not really brokenyou need a trick. 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// +  * 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 ===== ===== Indexmenu compatibility =====
Line 44: Line 55:
          $indexmenu->render('xhtml',$dummy_renderer, $handled);          $indexmenu->render('xhtml',$dummy_renderer, $handled);
 </code> </code>
 +
 +
 +===== 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'':
 +
 +<code diff>
 +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 @@
 + <?php
 +-$conf['index_pages'] = 'index,home,@subpage_with_same_name';
 ++$conf['index_pages'] = '@start_page,@subpage_with_same_name';
 + $conf['pagelist'] = 1;
 + $conf['search'] = 1;
 +diff -ur autosearch.old/conf/metadata.php autosearch/conf/metadata.php
 +--- autosearch.old/conf/metadata.php    2009-05-20 17:50:38.000000000 +0100
 ++++ autosearch/conf/metadata.php        2014-03-30 23:40:27.862105700 +0100
 +@@ -1,5 +1,5 @@
 + <?php
 + $meta['index_pages'] = array('multicheckbox',
 +-                          '_choices' => array('index','home','@subpage_with_same_name'));
 ++                          '_choices' => array('@start_page','@subpage_with_same_name'));
 + $meta['pagelist'] = array('onoff');
 + $meta['search'] = array('onoff');
 +</code>
 +
 +[[pinguim.ribeiro@gmail.com|Fernando Ribeiro]]
  
plugin/autosearch.1240174434.txt.gz · Last modified: 2009-10-07 15:05 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki