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 [2018-01-27 15:36] – updated Compatibility to include Frusterick Manners RiseUpplugin:meta [2022-09-08 17:52] (current) – [Meta Plugin] fiwswe
Line 6: Line 6:
 email      : freaks@dokuwiki.org email      : freaks@dokuwiki.org
 type       : syntax type       : syntax
-lastupdate : 2015-07-24 +lastupdate : 2021-10-16 
-compatible : Weatherwax, Binky, Ponder Stibbons, Hrun, Frusterick Manners+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 125: Line 125:
    
 //This comment 2016-01-02 08:08 by ''Wolf''// //This comment 2016-01-02 08:08 by ''Wolf''//
 +
 +===== 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 ===== ===== How to use the plugin =====
plugin/meta.1517063786.txt.gz · Last modified: 2018-01-27 15:36 by RiseUp

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