namespace_templates
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
namespace_templates [2010-09-23 01:18] – [Syntax] Aleksandr | 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 | + | If both (normal and inherited) templates are present in the same namespace, the normal '' |
- | * use FTP or WebDAV | + | |
- | * use the wiki to delete the original page. | + | |
+ | **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 [[syntax|wiki markup]]. | + | The content of the file is just standard [[wiki:syntax|wiki markup]]. |
==== Replacement patterns ==== | ==== Replacement patterns ==== | ||
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!@ |
+ | ^ @USER@ | ||
+ | ^ @NAME@ | ||
+ | ^ @MAIL@ | ||
+ | ^ @DATE@ | ||
+ | ^ %a %d-%m-%y etc. | e.g. Thu 06-12-12. [[phpfn> | ||
+ | ^ %% | a literal '' | ||
- | In addition you may also use any [[phpfn> | ||
- | ===== Editing | + | ===== Still editing |
- | You can't edit the '' | + | You can't edit the '' |
+ | * the easiest is using the [[plugin: | ||
+ | * or by setting up through | ||
==== 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)) 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 to create symlinks in the folder itself. Thus you create a '' | ||
+ | |||
+ | cd / | ||
+ | ln -s _template.txt template.txt | ||
+ | |||
+ | For these softlinks to work, you might need the FollowSymLinks option set for this directory in your webserver' | ||
+ | |||
+ | //**NOTE: This section contains instructions for use on a Windows server and will not work on a Linux system.**// | ||
+ | |||
+ | 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 ===== | ||
+ | |||
+ | Additional template features are implemented by plugins. | ||
- | >> I've used another method, creating a '' | + | * [[plugin: |
- | >> ('' | + | |
- | >> This way I can edit the template by going to some page in the namespace | + | |
- | >> (i.e. '' | + | |
- | >> | + | |
- | >> So this way you can use softlinks, but somewhat differently :) | + | |
- | \\ | + | |
- | > For softlinks the webserver probably needs the FollowSymLinks option set on the directory(tree). | + | |
- | \\ | + | |
- | ==== Editable templates for all users ==== | + | |
- | This way, all your templates | + | * [[plugin: |
+ | * '' | ||
+ | * '' | ||
+ | * and variants for deeper namespaces too and some other templates | ||
+ | All these plugins are only editable | ||
- | | + | |
- | - Now any user with write access in the namespace can create | + | |
- | * Note: This method has the advantage that new templates will immediately be recognized. This may not be the case with the other methods (adding files or symlinks manually into the DokuWiki folders). | + | |
- | ==== @GROUPS@ support ==== | + | * [[plugin: |
- | It may be interesting | + | |
- | <code unidiff> | + | * [[plugin: |
- | Index: dokuwiki-2009-02-14/ | + | |
- | =================================================================== | + | |
- | --- dokuwiki-2009-02-14.orig/ | + | |
- | +++ dokuwiki-2009-02-14/ | + | |
- | @@ -840,6 +840,7 @@ | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | + ' | + | |
- | ' | + | |
- | ), | + | |
- | array( | + | |
- | @@ -855,6 +856,7 @@ | + | |
- | | + | |
- | $INFO[' | + | |
- | | + | |
- | + implode(" | + | |
- | | + | |
- | ), $tpl); | + | |
- | + | ||
- | </ | + | ==== Troubleshooting ==== |
- | | + | Problem: An unexpected error occurs "no timestamp" |
- | ====== Suggestions ====== | + | 1. Solution: Before establishing the hidden template file, first create a dummy page via the DokuWiki GUI, like so: '' |
- | * Maybe setting | + | 2. Solution: The admin ''< |
namespace_templates.1285197521.txt.gz · Last modified: 2010-09-23 01:18 by Aleksandr