DokuWiki

It's better when it's simple

User Tools

Site Tools


namespace_templates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
namespace_templates [2016-11-03 02:21]
ach old revision restored (2016-03-11 07:57)
namespace_templates [2020-06-08 09:55] (current)
Klap-in [Table] add @!CURNS@,@!!CURNS@ and @!CURNS!@
Line 1: Line 1:
 ====== Namespace Templates ====== ====== Namespace Templates ======
  
-Sometimes you might want to have every page in a certain namespace based on a common skeleton. For example, in the ''address'' namespace you could have an already prepared table, which only needs to be filled with data. This can be easily achieved with so called "namespace templates"+Dokuwiki supports scaffolding. Sometimes you might want to have every page in a certain namespace based on a common skeleton. For example, in the ''address'' namespace you could have an already prepared table, which only needs to be filled with data. This can be easily achieved with so called "namespace templates".
  
 When a page is created, [[DokuWiki]] looks up whether a template file exists and it shows it within the editor window. The templates therefore are .txt files and should contain wiki markup. When a page is created, [[DokuWiki]] looks up whether a template file exists and it shows it within the editor window. The templates therefore are .txt files and should contain wiki markup.
  
 ===== Template files ===== ===== Template files =====
 +
 Two kinds of template files can be used: Two kinds of template files can be used:
  
Line 25: Line 26:
 Inside of the file, you may also use some replacement patterns to make the template a little more dynamic. Inside of the file, you may also use some replacement patterns to make the template a little more dynamic.
  
-^ @ID@     | full ID of the page                                                                    | +^ @ID@              | full ID of the page                                                                    | 
-^ @NS@     | namespace of the page                                                                  | +^ @NS@              | namespace of the page                                                                  
-^ @PAGE@   | page name (ID without namespace and underscores replaced by spaces)                    | +^ @CURNS@           | last part of the namespace of the page                                                 | 
-^ @!PAGE@  | same as above but with the first character uppercased                                  | +^ @!CURNS@          | same as above but with the first character uppercased                                  | 
-^ @!!PAGE@ | same as above but with the first character of all words uppercased                     | +^ @!!CURNS@         | same as above but with the first character of all words uppercased                     | 
-^ @!PAGE!@ | same as above but with all characters uppercased                                       | +^ @!CURNS!@         | same as above but with all characters uppercased                                       
-^ @FILE@   | page name (ID without namespace, underscores kept as is)                               | +^ @PAGE@            | page name (ID without namespace and underscores replaced by spaces)                    | 
-^ @!FILE@  | same as above but with the first character uppercased                                  | +^ @!PAGE@           | same as above but with the first character uppercased                                  | 
-^ @!FILE!@ | same as above but with all characters uppercased                                       | +^ @!!PAGE@          | same as above but with the first character of all words uppercased                     | 
-^ @USER@   | ID of user who is creating the page                                                    | +^ @!PAGE!@          | same as above but with all characters uppercased                                       | 
-^ @NAME@   | name of user who is creating the page                                                  | +^ @FILE@            | page name (ID without namespace, underscores kept as is)                               | 
-^ @MAIL@   | mail address of user who is creating the page                                          | +^ @!FILE@           | same as above but with the first character uppercased                                  | 
-^ @DATE@   | date and time when edit session started                                                | +^ @!FILE!@          | same as above but with all characters uppercased                                       | 
-^ %a %d-%m-%y etc. | e.g. Thu 06-12-12. [[phpfn>Strftime]] placeholders are replaced by page creation time | +^ @USER@            | ID of user who is creating the page                                                    | 
-^ %%       | a literal ''%'' character appears in your template                                     |+^ @NAME@            | name of user who is creating the page                                                  | 
 +^ @MAIL@            | mail address of user who is creating the page                                          | 
 +^ @DATE@            | date and time when edit session started                                                | 
 +^ %a %d-%m-%y etc.  | e.g. Thu 06-12-12. [[phpfn>strftime]] placeholders are replaced by page creation time  
 +^ %%                | a literal ''%'' character appears in your template                                     |
  
-In addition you may also use any [[phpfn>strftime]] placeholder to insert the time of page creation in any format you like. If you want to use a literal ''%'' character in your template you need to double it. 
  
 ===== Still editing templates via wiki===== ===== Still editing templates via wiki=====
  
 You can't edit the ''_template.txt'' through DokuWiki (only someone who can edit the files inside the filesystem folders (usually an administrator using FTP or WebDAV) can modify these files). There are three ways to accomplish this, though:  You can't edit the ''_template.txt'' through DokuWiki (only someone who can edit the files inside the filesystem folders (usually an administrator using FTP or WebDAV) can modify these files). There are three ways to accomplish this, though: 
-  * the easiest is using the [[plugin:TemplatePagename]] plugin which let you change the default templatename ''_template'' into another name e.g. ''template'' that is allowed as normal editable wikipage.+  * the easiest is using the [[plugin:TemplatePagename]] plugin which let you change the default templatenames ''<nowiki>_template</nowiki>'' and ''<nowiki>__template</nowiki>'' into another name. E.g. ''c_template'' and ''i_template''. These files are considered normal editable wikipages because they don't start with an underscore.
   * or by setting up through symbolic links     * or by setting up through symbolic links  
  
Line 73: Line 77:
  
 ===== Plugins ===== ===== Plugins =====
 +
 Additional template features are implemented by plugins. Additional template features are implemented by plugins.
  
Line 80: Line 85:
     * ''~yourpagename.txt'' for the page named ''yourpagename'' in the current namespace      * ''~yourpagename.txt'' for the page named ''yourpagename'' in the current namespace 
     * ''~yournamespace.txt'' for all pages in the subnamespace named ''yournamespace''     * ''~yournamespace.txt'' for all pages in the subnamespace named ''yournamespace''
-    * and variants for deeper namespaces too and some other templates e.g. for ''start'' pages.\\ All these plugins are only editable via the file system.+    * and variants for deeper namespaces too and some other templates e.g. for ''start'' pages. 
 +All these plugins are only editable via the file system.
  
   * [[plugin:NewPageTemplate]] Plugin adds a URL parameter that defines which existing page from the wiki is loaded as the template. Every page allowed by ACL is available.    * [[plugin:NewPageTemplate]] Plugin adds a URL parameter that defines which existing page from the wiki is loaded as the template. Every page allowed by ACL is available. 
Line 89: Line 95:
  
  
-===== @GROUPS@ support ===== 
- 
-It may be interesting to have support for the ''@GROUPS@'' keyword to extend to the group list of the user creating the page (e.g. to specify a set of tags on a user's home page). The following patch implements it. 
- 
-<code unidiff> 
-Index: dokuwiki-2009-02-14/inc/common.php 
-=================================================================== 
---- dokuwiki-2009-02-14.orig/inc/common.php    2009-11-19 11:58:41.000000000 +0100 
-+++ dokuwiki-2009-02-14/inc/common.php 2010-01-05 10:17:35.000000000 +0100 
-@@ -840,6 +840,7 @@ 
-                         '@USER@', 
-                         '@NAME@', 
-                         '@MAIL@', 
-+                        '@GROUPS@', 
-                         '@DATE@', 
-                      ), 
-                      array( 
-@@ -855,6 +856,7 @@ 
-                         $_SERVER['REMOTE_USER'], 
-                         $INFO['userinfo']['name'], 
-                         $INFO['userinfo']['mail'], 
-+                        implode(" ", $INFO['userinfo']['grps']), 
-                         $conf['dformat'], 
-                      ), $tpl); 
-  
- 
-</code> 
- 
- --- //[[shtrom-doku@ssji.net|Olivier Mehani]] 2010/01/05 10:19// 
namespace_templates.1478136108.txt.gz · Last modified: 2016-11-03 02:21 by ach