DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:category

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:category [2012-08-02 16:03] – [Introduction] 198.184.235.17plugin:category [2016-07-22 12:29] (current) 2.228.45.90
Line 1: Line 1:
-====== Categories Plugin ====== +Please refer to the [[Tag]] plugin. 
- +
-^ :!: Obsolete | This plugin will not be developed any further by its author. Use the [[plugin:tag|Tag-PlugIn]]! It does the same and in combination with other components can do much more. | +
- +
-===== Introduction ===== +
- +
-This [[plugins|plugin]] displays a list of keywords with links to categories the current page belongs toThose links are marked as [[http://www.technorati.com/tag/|Technorati tags]] and point to the page with the tag name in your wiki. For example for this page I could define "wiki:DokuWiki", "wiki:plugins", "plugin:category", "tag" and "person:Esther_Brunner" as categories: +
- +
-  ??wiki:DokuWiki wiki:plugins category :tag person:Esther_Brunner?? +
- +
-This would produce a list that looks like this:((Not exactly: With the plugin installed the list of keywords would be right-aligned.)) +
- +
----- +
- +
-[[DokuWiki]], [[plugins]], [[plugin:category]], [[:tag]], [[person:esther_brunner|Esther Brunner]] +
- +
- +
-===== Plugin ===== +
- +
-To install, put the following PHP file in ''/lib/plugins/category/syntax.php''+
- +
-<code php> +
-<?php +
-/** +
- * Category Plugin: displays list of keywords with links to categories this page +
- * belongs to. The links are marked as tags for Technorati and other services +
- * using tagging. +
- * +
- * Usage: ??category tags separated through spaces?? +
- * +
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) +
- * @author     Esther Brunner <esther [at] kaffeehaus [dot] ch> +
- */ +
-  +
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +
-require_once(DOKU_PLUGIN.'syntax.php'); +
-  +
-/** +
- * All DokuWiki plugins to extend the parser/rendering mechanism +
- * need to inherit from this class +
- */ +
-class syntax_plugin_category extends DokuWiki_Syntax_Plugin { +
- +
-    /** +
-     * return some info +
-     */ +
-    function getInfo(){ +
-        return array( +
-            'author' => 'Esther Brunner', +
-            'email'  => 'esther@kaffeehaus.ch', +
-            'date'   => '2005-07-12', +
-            'name'   => 'Category Plugin', +
-            'desc'   => 'Displays a list of keywords with links to categories this page belongs to. '. +
-                        'The links are marked as tags for Technorati and other services using tagging.', +
-            'url'    => 'http://www.dokuwiki.org/plugin:category', +
-        ); +
-    } +
- +
-    /** +
-     * What kind of syntax are we? +
-     */ +
-    function getType(){ +
-        return 'substition'; +
-    } +
-  +
-    /** +
-     * Where to sort in? +
-     */ +
-    function getSort(){ +
-        return 305; +
-    } +
-     +
-    /** +
-     * Paragraph Type +
-     */ +
-    function getPType(){ +
-        return 'block'; +
-    } +
-  +
-    /** +
-     * Connect pattern to lexer +
-     */ +
-    function connectTo($mode) { +
-        $this->Lexer->addSpecialPattern("\?\?.+?\?\?",$mode,'plugin_category'); +
-    } +
-   +
-    /** +
-     * Handle the match +
-     */ +
-    function handle($match, $state, $pos, &$handler){ +
-        $match = substr($match,2,-2);  // strip markup +
-        $match = explode(' ',$match);  // split tags +
-        return $match; +
-    }             +
-  +
-    /** +
-     * Create output +
-     */ +
-    function render($mode, &$renderer, $data) { +
-        global $ID; +
-        global $conf; +
-     +
-        if($mode == 'xhtml'){ +
-                         +
-            $renderer->doc .= '<div class="category">'; +
-            $c = count($data); +
-            for ($i = 0; $i < $c; $i++) { +
-                $tag = $data[$i]; +
-                $title = str_replace('_', ' ' ,noNS($tag)); +
-                resolve_pageid(getNS($ID),$tag,$exists); // resolve shortcuts +
-                if ($exists){ +
-                    $class = 'wikilink1'; +
-                    if ($conf['useheading']) { +
-                        $oldtitle = $title; +
-                        $title = trim(p_get_first_heading($tag)); +
-                        if (!$title) $title = $oldtitle; +
-                    } +
-                } else { +
-                    $class = 'wikilink2'; +
-                } +
-                $renderer->doc .= '<a href="'.wl($tag).'" class="'.$class.'" rel="tag" '. +
-                                  'onclick="return svchk()" onkeypress="return svchk()">'.$title.'</a>'; +
-                if ($i !== ($c - 1)) $renderer->doc .= ', '; +
-            } +
-            $renderer->doc .= '</div>'; +
-            return true; +
-        } +
-        return false; +
-    } +
-      +
-+
-  +
-//Setup VIM: ex: et ts=4 enc=utf-8 : +
-?></code> +
- +
-You can customize the look of the category ''<div>'' in ''lib/tpl/default/design.css'', for example with this style: +
- +
-<code css> +
-.category { +
-    padding-top: 3px; +
-    border-top: 2px dotted #dee7ec; +
-    text-align: right; +
-}</code> +
- +
-===== Changes ===== +
- +
-  * 2005-07-01: style changed from table to right aligned keyword list after a horizontal rule. +
-  * 2005-07-12: +
-    * now allows subnamespaces -- thanks to Geoffrey Roberts for this suggestion! +
-    * if $conf['useheading'] is on the first heading is used instead of the ID +
-    * style changed again to customizable div ''.category'' +
-  * 2005-09-13: +
-    * if $conf['useheading'] is enabled display the pagename if there is no heading +
- +
-> Note that the JavaScript function "svchk()" no longer exists (and is now unnecessary) in Dokuwiki, and does cause JavaScript errors, so references should be removed. +
->-- [[todd@rollerorgans.com]] 2007-02-26 +
  
 +The Tag plugin is the up to date replacement of Category plugin.
plugin/category.1343916230.txt.gz · Last modified: 2012-08-02 16:03 by 198.184.235.17

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