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-04-26 15:01] – 193.191.9.45 | 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 [[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, 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. | ||
- | >> I've used another method, creating | + | Another way is to create symlinks in the folder itself. Thus you create |
- | >> ('' | + | |
- | >> This way I can edit the template by going to some page in the namespace and then replace the pagename by ' | + | |
- | >> (i.e. '' | + | |
- | >> | + | |
- | >> So this way you can use softlinks, but somewhat differently :) | + | For these softlinks |
- | \\ | + | |
- | > For softlinks | + | //**NOTE: This section contains instructions for use on a Windows server and will not work on a Linux system.**// |
- | \\ | + | |
- | ==== Editable templates for all users | + | 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:\inetpub\wiki\data\pages\namespace\something | ||
+ | mklink template.txt _template.txt | ||
+ | |||
+ | ===== Plugins | ||
+ | |||
+ | Additional template features are implemented by plugins. | ||
+ | |||
+ | * [[plugin: | ||
- | 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 the default template pagename in the config prevents messing with common.php, which will break the hack when an update is performed. With ACL access to these template files can be restricted. | + | 2. Solution: The admin '' |
- | * It would be useful to have templates for special page names. For example | + | |
- | * I was inspired by this suggestion (and also annoyed at creating a lot of pages that had the same formatting) so I did some editing. http://pastebin.com/YHGk6T4F That is the common.php I run that searches parent namespaces for a template named after the current page. If it doesn' | + | |
- | * This was exactly the functionality I needed. So I converted [[user> | + | |
- | * To avoid naming conflicts, a different template name system | + |
namespace_templates.1335445281.txt.gz · Last modified: 2012-04-26 15:01 by 193.191.9.45