DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:meta

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:meta [2016-04-27 21:59] – Updated author/email LarsDW223plugin:meta [2022-09-08 17:52] (current) – [Meta Plugin] fiwswe
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: Set Metadata for the current page. (previous authors: Esther Brunner, Gina Häußge, Michael Klier) +description: Set Metadata for the current page 
-author     : Dokufreaks (formerly Michael Hamann, Esther Brunner, Gina Häußge, Michael Klier) +author     : Dokufreaks (previous authors: Michael Hamann, Esther Brunner, Gina Häußge, Michael Klier) 
-email      : dokuwiki@freelists.org+email      : freaks@dokuwiki.org
 type       : syntax type       : syntax
-lastupdate : 2015-07-24 +lastupdate : 2021-10-16 
-compatible : Weatherwax, Binky, Ponder Stibbons, Hrun+compatible : Weatherwax, Binky, Ponder Stibbons, Hrun, Frusterick Manners, Greebo, Hogfather, Igor
 depends    :  depends    : 
 conflicts  conflicts 
Line 22: Line 22:
 ===== Description ===== ===== Description =====
  
-This [[plugins|plugin]] allows you to set [[:metadata]] for a page. This is useful for overriding default [[:DokuWiki]] metadata, for example if you want to display someone else than the user who pasted the text into the wiki as the author of a [[blog]] entry.+This plugin allows you to set [[:metadata]] for a page. This is useful for overriding default [[:DokuWiki]] metadata, for example if you want to display someone else than the user who pasted the text into the wiki as the author of a [[blog]] entry.
  
 ===== Syntax ===== ===== Syntax =====
Line 126: Line 126:
 //This comment 2016-01-02 08:08 by ''Wolf''// //This comment 2016-01-02 08:08 by ''Wolf''//
  
-=====How-to-use-the-Plugin =====+===== Simple patch that allows to use Metadata in your pages ===== 
 + 
 +<code diff> 
 +--- syntax.php.orig 2019-08-15 16:10:59.057459368 -0400 
 ++++ syntax.php 2019-08-16 02:29:46.258100543 -0400 
 +@@ -43,4 +43,6 @@ 
 +     function render($mode, Doku_Renderer $renderer, $data) { 
 +-        if ($mode == 'xthml') { 
 +-            return true; // don't output anything 
 ++        if ($mode == 'xhtml') { 
 ++            global $ID; 
 ++            foreach($data as $key=>$value)  
 ++                if($key && (!$value or is_array($value) && !current($value))) $renderer->doc .= strtr(p_get_metadata($ID, $key.' '.($value?key($value):'')), $data[(string) NULL]?:array());  
 +         } elseif ($mode == 'metadata') { 
 +@@ -89,3 +91,3 @@ 
 +                     // no special treatment for the rest 
 +               } else { 
 ++                } elseif( $key && $value ) { 
 +                     $renderer->meta[$key] $value; 
 +</code> 
 + 
 +Now you can put to your pages something like: 
 +  My creator is ~~META:creator~~! 
 +  ~~META:creator 
 +  & superadmin=Yay, page created by superadmin! 
 +  & shyuser=Oh, page created by very modest user.. 
 +  ~~ 
 + 
 +And don't forget that DokuWiki allows you to store any custom Metadata! 
 + 
 + --- [[user>annelin|ann. / OÜ Narayana]] //2019-08-16 06:55// 
 + 
 +===== How to use the plugin ===== 
 + 
 +Please read http://forum.dokuwiki.org/post/15988 about how to use the plugin. //[[hemmerling@gmx.net|Rolf Hemmerling]] 2009-12-05//
  
-Please read 
-http://forum.dokuwiki.org/post/15988 about how to use the plugin. //[[hemmerling@gmx.net|Rolf Hemmerling]] 2009-12-05// 
plugin/meta.1461787147.txt.gz · Last modified: 2016-04-27 21:59 by LarsDW223

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