namespace_templates
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
namespace_templates [2012-12-06 15:14] – [Replacement patterns] Klap-in | namespace_templates [2024-05-03 09:02] (current) – [Template files] differentiated zweihorn | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Namespace Templates ====== | ====== Namespace Templates ====== | ||
- | Sometime | + | Dokuwiki supports scaffolding. Sometimes |
- | When a page is created, [[DokuWiki]] looks up whether a template | + | When a page is created, [[DokuWiki]] looks up whether a template |
===== Template files ===== | ===== Template files ===== | ||
- | Two kinds of template files can be used : | ||
- | * '' | + | Two kinds of template files can be used: |
- | * '' | + | |
- | One way to create | + | * '' |
+ | * '' | ||
- | * use the wiki to save a page with the content that you want to use as a template into the appropriate namespace | + | If both (normal and inherited) templates are present |
- | * use FTP or WebDAV to make a copy of it in the same folder and rename it, then | + | |
- | * use the wiki to delete the original | + | |
+ | **NOTE:** Any changes to a.m. template files will //only effect newly created pages// and existing pages are always left untouched. | ||
+ | |||
+ | 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 FTP or WebDAV to rename it as _template.txt | ||
+ | |||
+ | 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 23: | 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 |
- | ^ @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 | + | ^ @!CURNS!@ |
- | ^ @FILE@ | + | ^ @PAGE@ |
- | ^ @!FILE@ | + | ^ @!PAGE@ |
- | ^ @!FILE!@ | same as above but with all characters uppercased | + | ^ @!!PAGE@ |
- | ^ @USER@ | + | ^ @!PAGE!@ |
- | ^ @NAME@ | + | ^ @FILE@ |
- | ^ @MAIL@ | + | ^ @!FILE@ |
- | ^ @DATE@ | + | ^ @!FILE!@ |
- | ^ %a %d-%m-%y etc. | e.g. Thu 06-12-12. [[phpfn>Strftime]] placeholders are replaced by page creation time | | + | ^ @USER@ |
- | ^ %% | + | ^ @NAME@ |
+ | ^ @MAIL@ | ||
+ | ^ @DATE@ | ||
+ | ^ %a %d-%m-%y etc. | e.g. Thu 06-12-12. [[phpfn>strftime]] placeholders are replaced by page creation time | | ||
+ | ^ %% | a literal '' | ||
- | In addition you may also use any [[phpfn> | ||
- | ===== Editing templates ===== | ||
- | You can't edit the '' | + | ===== Still editing templates via wiki===== |
- | * one involving setting up symbolic links once, | + | |
- | * one involving a code change | + | You can't edit the '' |
- | * or the easiest is using a plugin | + | * the easiest is using the [[plugin: |
+ | * or by setting up through symbolic links | ||
==== Editable templates through symbolic links ==== | ==== Editable templates through symbolic links ==== | ||
+ | //**NOTE: This section contains instructions for use on a Linux server and will not work on a Windows system.**// | ||
- | This way, you can store your templates in a special namespace. By making a symlink | + | This way, you can store your templates in a special namespace, and make symlinks for DokuWiki |
- Create a namespace called " | - Create a namespace called " | ||
- | - In this namespace, create a page for each [[: | + | - In this namespace, create a page for each [[: |
- Follow the instructions given above, but make _template.txt a hard link ((soft links seem not to work, but see the note about FollowSymLinks below)) to the correct page under your templates namespace. | - Follow the instructions given above, but make _template.txt a hard link ((soft links seem not to work, but see the note about FollowSymLinks below)) to the correct page under your templates namespace. | ||
- | Another way is creating | + | Another way is to create |
cd / | cd / | ||
ln -s _template.txt template.txt | ln -s _template.txt template.txt | ||
| | ||
- | For these softlinks | + | For these softlinks |
- | + | ||
- | ==== Editable templates for all users ==== | + | //**NOTE: This section contains instructions for use on a Windows server and will not work on a Linux system.**// |
- | + | ||
- | This way, all your templates will be editable by anybody with write access. It's changing hardcode the filename the source is looking for. | + | |
- | + | ||
- | - Change the default template name to " | + | |
- | - Now any user with write access in the namespace can create a page called " | + | |
- | | + | |
+ | Open up command prompt (cmd.exe) on the server, and browse to the location you with there to be a template. Use the MKLINK command to create a symbolic link. | ||
+ | cd c: | ||
+ | mklink template.txt _template.txt | ||
===== Plugins ===== | ===== Plugins ===== | ||
+ | |||
Additional template features are implemented by plugins. | Additional template features are implemented by plugins. | ||
+ | |||
+ | * [[plugin: | ||
* [[plugin: | * [[plugin: | ||
Line 80: | Line 88: | ||
* '' | * '' | ||
* 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. | ||
- | * [[plugin: | + | * [[plugin: |
- | + | ||
- | * [[plugin: | + | |
* [[plugin: | * [[plugin: | ||
- | Some of the plugins | + | * [[plugin: |
- | ==== @GROUPS@ support | + | ==== Troubleshooting |
- | It may be interesting to have support for the '' | + | |
- | <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.1354803246.txt.gz · Last modified: 2012-12-06 15:14 by Klap-in