plugin:autostart
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:autostart [2010-10-04 22:33] – downloadurl Aleksandr | plugin:autostart [2024-03-15 15:25] (current) – removed old stuff einhirn | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== autostart | + | ====== autostart |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
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 | ||
Line 13: | Line 13: | ||
tags : redirect | tags : redirect | ||
- | downloadurl: | + | downloadurl: |
- | bugtracker : | + | bugtracker : https:// |
- | sourcerepo : | + | sourcerepo : https:// |
donationurl: | 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' | I think the [[autosearch]] plugin does this, but I haven' | ||
| | ||
===== Source Code ===== | ===== Source Code ===== | ||
- | Create a directory '' | ||
- | <code php> | ||
- | <?php | ||
- | /** | ||
- | * Autostart Plugin: Redirects to the namespace' | ||
- | * | ||
- | * @author Jesús A. Álvarez < | ||
- | */ | ||
- | |||
- | if (!defined(' | ||
- | if (!defined(' | ||
- | require_once (DOKU_PLUGIN . ' | ||
- | |||
- | class action_plugin_autostart extends DokuWiki_Action_Plugin | ||
- | { | ||
- | function getInfo() { | ||
- | return array ( | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ); | ||
- | } | ||
- | | ||
- | function page_exists($id) { | ||
- | if (function_exists(' | ||
- | return page_exists($id); | ||
- | else | ||
- | return @file_exists(wikiFN($id)); | ||
- | } | ||
- | | ||
- | function register(& | ||
- | $controller-> | ||
- | } | ||
- | | ||
- | function preprocess(& | ||
- | global $conf; | ||
- | global $ID; | ||
- | if (!$this-> | ||
- | { | ||
- | if($this-> | ||
- | // start page inside namespace | ||
- | $id = $ID.':' | ||
- | elseif($this-> | ||
- | // page named like the NS inside the NS | ||
- | $id = $ID.':' | ||
- | if ($id) header(' | ||
- | } | ||
- | } | ||
- | |||
- | } | ||
- | </ | ||
- | ===== 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 |
- | \\ | + | |
- | Very handy plugin, great work! By the way: redirecting into a namespace (e.g. foobar | + | |
- | < | ||
- | --- lib/ | ||
- | +++ lib/ | ||
- | @@ -36,7 +36,7 @@ | ||
- | | ||
- | | ||
- | | ||
- | - if (!$this-> | ||
- | + if (!$this-> | ||
- | { | ||
- | | ||
- | // start page inside namespace | ||
- | </ | ||
- | Andreas de Pretis < |
plugin/autostart.1286224438.txt.gz · Last modified: 2010-10-04 22:33 by Aleksandr