DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:previous

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
plugin:previous [2010-11-03 16:25]
Theo-K [Installation]
plugin:previous [2015-05-27 22:36] (current)
Klap-in
Line 19: Line 19:
 In your plugins folder create a folder named "previous". In this folder you create the file syntax.php with the following content In your plugins folder create a folder named "previous". In this folder you create the file syntax.php with the following content
  
-<code php>+<code php syntax.php>
 <?php <?php
 /** /**
Line 31: Line 31:
 if (!defined('DOKU_INC')) die(); if (!defined('DOKU_INC')) die();
  
-if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); 
-if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); 
-if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
- 
-require_once DOKU_PLUGIN.'syntax.php'; 
  
 class syntax_plugin_previous extends DokuWiki_Syntax_Plugin { class syntax_plugin_previous extends DokuWiki_Syntax_Plugin {
Line 46: Line 41:
  
  
-    function handle($match, $state, $pos, &$handler){+    function handle($match, $state, $pos, Doku_Handler $handler){
  $match = substr($match, 8, -2);  $match = substr($match, 8, -2);
         list($url, $alt)   = explode('>',$match,2);         list($url, $alt)   = explode('>',$match,2);
Line 59: Line 54:
  
  
- function render($mode, &$R, $data) {+ function render($mode, Doku_Renderer $R, $data) {
         if($mode != 'xhtml') return false;         if($mode != 'xhtml') return false;
  
-        if(!$data['url']){ 
             $R->doc .= '<div class="plugin_previous">';             $R->doc .= '<div class="plugin_previous">';
             $R->doc .= '<a href="javascript:history.go(-1)" title="'.hsc($data['alt']).'">';             $R->doc .= '<a href="javascript:history.go(-1)" title="'.hsc($data['alt']).'">';
Line 68: Line 62:
             $R->doc .= '</a>';             $R->doc .= '</a>';
             $R->doc .= '</div>';             $R->doc .= '</div>';
-        }else{ +
-            $R->doc .= '<div class="plugin_previous">'; +
-            $R->doc .= '<a href="javascript:history.go(-1)" title="'.hsc($data['alt']).'">'; +
-            $R->doc .= hsc($data['alt']); +
-            $R->doc .= '</a>'; +
-            $R->doc .= '</div>'; +
-        }+
         return true;         return true;
  }  }
Line 86: Line 74:
 If you want an other color or anything; create a style.css file within the Previous map, with for example: If you want an other color or anything; create a style.css file within the Previous map, with for example:
  
-<code css>+<code css style.css>
 div.plugin_previous a{ div.plugin_previous a{
   color: #007500 !important;   color: #007500 !important;
plugin/previous.1288797950.txt.gz · Last modified: 2010-11-03 16:25 by Theo-K