====== previous plugin ====== ---- plugin ---- description: Plugin to use the history.back command from javascript within a wiki page. Originally created to use for fullscreen and presentation usage. author : Theo email : tr.klein AT tvm DOT nl type : Syntax lastupdate : 2010-11-03 compatible : depends : conflicts : similar : tags : navigation ---- ===== Installation ===== In your plugins folder create a folder named "previous". In this folder you create the file syntax.php with the following content */ // must be run within Dokuwiki if (!defined('DOKU_INC')) die(); class syntax_plugin_previous extends DokuWiki_Syntax_Plugin { function getType() { return 'substition'; } function getPType() { return 'block'; } function getSort() { return 304; } function connectTo($mode) { $this->Lexer->addSpecialPattern('{{goback>.*?}}',$mode,'plugin_previous'); } function handle($match, $state, $pos, Doku_Handler $handler){ $match = substr($match, 8, -2); list($url, $alt) = explode('>',$match,2); // set defaults $opts = array( 'alt' => $alt, ); return $opts; } function render($mode, Doku_Renderer $R, $data) { if($mode != 'xhtml') return false; $R->doc .= '
'; $R->doc .= ''; $R->doc .= hsc($data['alt']); $R->doc .= ''; $R->doc .= '
'; return true; } } // vim:ts=4:sw=4:et:enc=utf-8:
==== Optional: Css ==== If you want an other color or anything; create a style.css file within the Previous map, with for example: div.plugin_previous a{ color: #007500 !important; } ===== Syntax and Usage ===== The use is fairly easy, since this plugin was created for one purpose only: go back! Syntax examples: {{goback>TEXT}} or {{goback>or multiple words..}} You can use any text you want, it will display as a ordinary link. Keep in mind this plugin will only go back one page in your current browser (or tab) history. It does not work on breadcrumbs (which can be a combination of various sessions in multiple windows/tabs). ===== Questions ===== Should anyone have questions... here's the place :-)