DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:autostart

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:autostart [2009-01-03 11:49] 67.170.0.207plugin:autostart [2024-03-15 15:25] (current) – removed old stuff einhirn
Line 1: Line 1:
-====== autostart plugin ======+====== autostart Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Handles non-existent pages by redirecting to the namespace's start page if available.+description: Handles non-existent pages by redirecting to the namespace's start page if available
 author     : Jesús A. Álvarez author     : Jesús A. Álvarez
 email      : zydeco@namedfork.net email      : zydeco@namedfork.net
 type       : syntax type       : syntax
-lastupdate : 2008-04-28 +lastupdate : 2020-11-15 
-compatible : >= 2006-11-06+compatible : Hogfather
 depends    :  depends    : 
 conflicts  conflicts 
 similar    : autosearch similar    : autosearch
-tags       : index start redirect +tags       : redirect
-----+
  
-^  Download | [[http://namedfork.net/files/dokuwiki-plugin-autostart.tgz|dokuwiki-plugin-autostart.tgz]] |+downloadurl: https://github.com/parmaja/autostart/archive/master.zip 
 +bugtracker : https://github.com/parmaja/autostart/issues 
 +sourcerepo : https://github.com/parmaja/autostart 
 +donationurl:  
 + 
 +screenshot_img:  
 +----
  
 ===== Description ===== ===== Description =====
 +
 If a non-existent page is requested, but a namespace with that name exists, and it has a start page, you will be redirected to it.  If a non-existent page is requested, but a namespace with that name exists, and it has a start page, you will be redirected to it. 
 +
 I think the [[autosearch]] plugin does this, but I haven't been able to obtain it. I think the [[autosearch]] plugin does this, but I haven't been able to obtain it.
      
 ===== Source Code ===== ===== Source Code =====
-Create a directory ''autostart'' in ''/wiki/lib/plugins'' and save the code in a ''action.php'' file there. 
-<code php> 
-<?php 
-/** 
- * Autostart Plugin: Redirects to the namespace's start page if available 
- * 
- * @author Jesús A. Álvarez <zydeco@namedfork.net> 
- */ 
-  
-if (!defined('DOKU_INC')) die(); 
-if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); 
-require_once (DOKU_PLUGIN . 'action.php'); 
-  
-class action_plugin_autostart extends DokuWiki_Action_Plugin 
-{ 
-    function getInfo() { 
-        return array ( 
-            'author' => 'Jesús A. Álvarez', 
-            'email' => 'zydeco@namedfork.net', 
-            'date' => '2008-04-28', 
-            'name' => 'Autostart Plugin', 
-            'desc' => "Redirect from the namespace's name to its start page", 
-            'url' => 'http://www.dokuwiki.org/plugin:autostart', 
-        ); 
-    } 
-     
-    function page_exists($id) { 
-        if (function_exists('page_exists')) 
-            return page_exists($id); 
-        else 
-            return @file_exists(wikiFN($id)); 
-    } 
-     
-    function register(&$controller) { 
-        $controller->register_hook('ACTION_ACT_PREPROCESS', 'AFTER', $this, 'preprocess', array ()); 
-    } 
-     
-    function preprocess(& $event, $param) { 
-        global $conf; 
-        global $ID; 
-        if (!$this->page_exists($ID) && $event->data == 'show') 
-        { 
-            if($this->page_exists($ID.':'.$conf['start'])) 
-                // start page inside namespace 
-                $id = $ID.':'.$conf['start']; 
-            elseif($this->page_exists($ID.':'.noNS(cleanID($ID)))) 
-                // page named like the NS inside the NS 
-                $id = $ID.':'.noNS(cleanID($ID)); 
-            if ($id) header('Location: ' . wl($id,'',true)); 
-        } 
-    } 
-  
-} 
-</code> 
  
-===== Discussion ===== +See link above. 
-Nice work! Thanks! Jason Xun Xu <jasonxu.dev@gmail.com>+ 
 +I changed download link to gihtub repo into my account, when the author want it i will transfer to him account --- [[user>zaher|zaher]] //2020-11-15 17:38// 
 + 
plugin/autostart.1230979780.txt.gz · Last modified: 2009-10-07 15:03 (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