plugin:category
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:category [2012-08-02 16:03] – [Introduction] 198.184.235.17 | plugin: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 to. Those links are marked as [[http:// | + | |
- | + | ||
- | ?? | + | |
- | + | ||
- | This would produce a list that looks like this:((Not exactly: With the plugin installed the list of keywords would be right-aligned.)) | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | [[DokuWiki]], | + | |
- | + | ||
- | + | ||
- | ===== Plugin ===== | + | |
- | + | ||
- | To install, put the following PHP file in ''/ | + | |
- | + | ||
- | <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 | + | |
- | * @author | + | |
- | */ | + | |
- | + | ||
- | if(!defined(' | + | |
- | if(!defined(' | + | |
- | require_once(DOKU_PLUGIN.' | + | |
- | + | ||
- | /** | + | |
- | * All DokuWiki plugins to extend the parser/ | + | |
- | * need to inherit from this class | + | |
- | */ | + | |
- | class syntax_plugin_category extends DokuWiki_Syntax_Plugin { | + | |
- | + | ||
- | /** | + | |
- | * return some info | + | |
- | */ | + | |
- | function getInfo(){ | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | 'The links are marked as tags for Technorati and other services using tagging.', | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * What kind of syntax are we? | + | |
- | */ | + | |
- | function getType(){ | + | |
- | return ' | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Where to sort in? | + | |
- | */ | + | |
- | function getSort(){ | + | |
- | return 305; | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Paragraph Type | + | |
- | */ | + | |
- | function getPType(){ | + | |
- | return ' | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Connect pattern to lexer | + | |
- | */ | + | |
- | function connectTo($mode) { | + | |
- | $this-> | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Handle the match | + | |
- | */ | + | |
- | function handle($match, | + | |
- | $match = substr($match, | + | |
- | $match = explode(' | + | |
- | return $match; | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * Create output | + | |
- | */ | + | |
- | function render($mode, | + | |
- | global $ID; | + | |
- | global $conf; | + | |
- | + | ||
- | if($mode == ' | + | |
- | + | ||
- | $renderer-> | + | |
- | $c = count($data); | + | |
- | for ($i = 0; $i < $c; $i++) { | + | |
- | $tag = $data[$i]; | + | |
- | $title = str_replace(' | + | |
- | resolve_pageid(getNS($ID), | + | |
- | if ($exists){ | + | |
- | $class = ' | + | |
- | if ($conf[' | + | |
- | $oldtitle = $title; | + | |
- | $title = trim(p_get_first_heading($tag)); | + | |
- | if (!$title) $title = $oldtitle; | + | |
- | } | + | |
- | } else { | + | |
- | $class = ' | + | |
- | } | + | |
- | $renderer-> | + | |
- | ' | + | |
- | if ($i !== ($c - 1)) $renderer-> | + | |
- | } | + | |
- | $renderer-> | + | |
- | return true; | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | + | ||
- | } | + | |
- | + | ||
- | //Setup VIM: ex: et ts=4 enc=utf-8 : | + | |
- | ?></ | + | |
- | + | ||
- | You can customize the look of the category ''< | + | |
- | + | ||
- | <code css> | + | |
- | .category { | + | |
- | padding-top: | + | |
- | border-top: 2px dotted #dee7ec; | + | |
- | text-align: right; | + | |
- | }</ | + | |
- | + | ||
- | ===== 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[' | + | |
- | * style changed again to customizable div '' | + | |
- | * 2005-09-13: | + | |
- | * if $conf[' | + | |
- | + | ||
- | > Note that the JavaScript function " | + | |
- | >-- [[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