DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:talkpage

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:talkpage [2016-01-24 14:17] – version upped andiplugin:talkpage [2022-08-24 12:32] (current) – Compatible with Igor 194.81.223.66
Line 6: Line 6:
 email      : andi@splitbrain.org  email      : andi@splitbrain.org 
 type       : syntax type       : syntax
-lastupdate : 2014-05-21 +lastupdate : 2018-11-18 
-compatible : Adora Belle+compatible : Igor, Hogfather, Greebo, Frusterick Manners, Elenor of Tsort
 depends    :  depends    : 
 conflicts  conflicts 
Line 23: Line 23:
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 === Change Log === === Change Log ===
Line 31: Line 31:
 ===== Syntax ===== ===== Syntax =====
  
-Simply add the macro ''~~TALKPAGE~~'' anywhere in your sidebar page.+If the template of your choice does not support the [[:main_window#page_tools|page tools menu]], simply add the macro ''~~TALKPAGE~~'' anywhere in your sidebar page.
  
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
Line 37: Line 37:
 The namespace where talk pages are stored can be set in the config manager. It defaults to ''talk''. The namespace where talk pages are stored can be set in the config manager. It defaults to ''talk''.
  
-===== Discussion ===== 
  
-I would be super handy if this plugin could generate the discussion link in the floating page tools with the TEMPLATE_PAGETOOLS_DISPLAY event. I know it should be fairly easy but I don't know how to do it unfortunately. --- [[user>Laynee|Laynee]] //2015-07-27 02:42// 
- 
-=== Several Meta Pages === 
-I added some lines to have multiple meta-pages related to one article page. Here it is an additional data page which could provide rawdata to use for example with the include plugin. Maybe some more people are interested? 
-<code php> 
-<?php 
-/** 
- * DokuWiki Plugin talkpage (Syntax Component) 
- * 
- * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 
- * @author  Andreas Gohr <andi@splitbrain.org> 
- */ 
- 
-// must be run within Dokuwiki 
-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_talkpage extends DokuWiki_Syntax_Plugin { 
-    public function getType() { 
-        return 'substition'; 
-    } 
- 
-    public function getPType() { 
-        return 'normal'; 
-    } 
- 
-    public function getSort() { 
-        return 444; 
-    } 
- 
- 
-    public function connectTo($mode) { 
-        $this->Lexer->addSpecialPattern('~~TALKPAGE~~',$mode,'plugin_talkpage'); 
-    } 
- 
-    public function handle($match, $state, $pos, &$handler){ 
-        $data = array(); 
- 
-        return $data; 
-    } 
- 
-    public function render($mode, &$renderer, $data) { 
-        global $INFO; 
-        if($mode != 'xhtml') return false; 
- 
-        $renderer->info['cache'] = false; 
- 
-        $talkns = cleanID($this->getConf('talkns')); 
- $datans = cleanID($this->getConf('datans')); 
-  
-        if(substr($INFO['id'],0,strlen($talkns)+1) === "$talkns:"){ 
-            // we're on the talk page 
-            $goto1 = substr($INFO['id'],strlen($talkns)+1); 
- $goto2 = $datans .':'.substr($INFO['id'],strlen($talkns)+1); 
-            $text1 = 'back'; 
- $text2 = 'data'; 
- }elseif(substr($INFO['id'],0,strlen($talkns)+1) === "$datans:"){ 
-            // we're on the data page 
- $goto1 = substr($INFO['id'],strlen($datans)+1); 
- $goto2 = $talkns .':'.substr($INFO['id'],strlen($datans)+1); 
-            $text1 = 'back'; 
- $text2 = 'talk'; 
-        }else{ 
- // we are on article page 
-            // we want to the talk or data page 
-            $goto1 = $talkns .':'.$INFO['id']; 
- $goto2 = $datans .':'.$INFO['id']; 
- $text1 = 'talk'; 
- $text2 = 'data'; 
-            //if(page_exists($talkpage)){ 
-            //    $text = 'talk'; 
-            //}else{ 
-            //    $text = 'add'; 
-            //} 
-        } 
- 
-        $renderer->doc .= '<a href="'.wl($goto1).'" class="talkpage talkpage-'.$text1.'">'.$this->getLang($text1).'</a><br> <a href="'.wl($goto2).'" class="talkpage talkpage-'.$text2.'">'.$this->getLang($text2).'</a>'; 
- 
-        return true; 
-    } 
-} 
- 
-// vim:ts=4:sw=4:et: 
-</code> 
- 
- --- //Boris 2016/01/17 20:19// 
plugin/talkpage.1453641440.txt.gz · Last modified: 2016-01-24 14:17 by andi

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