namespace_templates
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
namespace_templates [2019-01-25 17:41] – [Plugins] Dr-Yukon | namespace_templates [2024-05-03 09:02] (current) – [Template files] differentiated zweihorn | ||
---|---|---|---|
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 '' | + | Dokuwiki supports scaffolding. |
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: | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
+ | |||
+ | If both (normal and inherited) templates are present in the same namespace, | ||
- | If both (inherited | + | **NOTE:** Any changes to a.m. template files will //only effect newly created pages// |
- | One way to create the template file is to | + | One way to create the template file is to: |
- use the wiki to save a page with the content that you want to use as a template into the appropriate namespace | - use the wiki to save a page with the content that you want to use as a template into the appropriate namespace | ||
- | - use FTP or WebDAV to rename it as _template.txt, then | + | - use FTP or WebDAV to rename it as _template.txt |
- | - Note: ((These changes only apply to new pages that you create in the namespace.)) | + | |
+ | However, one should prefer the [[plugin: | ||
===== Syntax ===== | ===== Syntax ===== | ||
The content of the file is just standard [[wiki: | The content of the file is just standard [[wiki: | ||
Line 25: | Line 28: | ||
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@ | + | ^ @ID@ | full ID of the page | |
- | ^ @NS@ | + | ^ @NS@ | namespace of the page | |
- | ^ @CURNS@ | + | ^ @CURNS@ |
- | ^ @PAGE@ | + | ^ @!CURNS@ |
- | ^ @!PAGE@ | + | ^ @!!CURNS@ |
- | ^ @!!PAGE@ | same as above but with the first character of all words uppercased | + | ^ @!CURNS!@ |
- | ^ @!PAGE!@ | same as above but with all characters uppercased | + | ^ @PAGE@ |
- | ^ @FILE@ | + | ^ @!PAGE@ |
- | ^ @!FILE@ | + | ^ @!!PAGE@ |
- | ^ @!FILE!@ | same as above but with all characters uppercased | + | ^ @!PAGE!@ |
- | ^ @USER@ | + | ^ @FILE@ |
- | ^ @NAME@ | + | ^ @!FILE@ |
- | ^ @MAIL@ | + | ^ @!FILE!@ |
- | ^ @DATE@ | + | ^ @USER@ |
- | ^ %a %d-%m-%y etc. | e.g. Thu 06-12-12. [[phpfn> | + | ^ @NAME@ |
- | ^ %% | + | ^ @MAIL@ |
+ | ^ @DATE@ | ||
+ | ^ %a %d-%m-%y etc. | e.g. Thu 06-12-12. [[phpfn> | ||
+ | ^ %% | a literal '' | ||
Line 83: | Line 89: | ||
* and variants for deeper namespaces too and some other templates e.g. for '' | * and variants for deeper namespaces too and some other templates e.g. for '' | ||
All these plugins are only editable via the file system. | All these plugins are only editable via the file system. | ||
+ | |||
* [[plugin: | * [[plugin: | ||
+ | |||
* [[plugin: | * [[plugin: | ||
- | * [[plugin: | ||
- | ===== @GROUPS@ support ===== | + | * [[plugin: |
- | It may be interesting to have support for the '' | + | ==== Troubleshooting ==== |
- | <code unidiff> | + | Problem: An unexpected error occurs "no timestamp" |
- | Index: dokuwiki-2009-02-14/inc/ | + | |
- | =================================================================== | + | |
- | --- dokuwiki-2009-02-14.orig/inc/common.php | + | |
- | +++ dokuwiki-2009-02-14/inc/ | + | |
- | @@ -840,6 +840,7 @@ | + | |
- | '@USER@', | + | |
- | '@NAME@', | + | |
- | '@MAIL@', | + | |
- | + | + | |
- | '@DATE@', | + | |
- | ), | + | |
- | array( | + | |
- | @@ -855,6 +856,7 @@ | + | |
- | | + | |
- | | + | |
- | | + | |
- | + implode(" | + | |
- | | + | |
- | ), $tpl); | + | |
- | + | ||
- | </code> | + | 1. Solution: Before establishing the hidden template file, first create a dummy page via the DokuWiki GUI, like so: '' |
- | | + | 2. Solution: The admin ''< |
namespace_templates.txt · Last modified: 2024-05-03 09:02 by zweihorn