DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:pagetemplate

Pagetemplate Plugin

Compatible with DokuWiki

2006-11-06

plugin Link syntax copies existing page to new page at creation.

Last updated on
2007-08-23
Provides
Syntax, Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with !experimental, editing, links, template

Version0.2 alpha
Statusexperimental
Download pagetemplate.zip

Description

The Pagetemplate Plugin is a new link syntax. If the page does not yet exist, it will create the page in the normal fashion. The new page, however, will not be empty ,but will contain the content copied from another page in the wiki. Once the page has been created, the pagetemplate link functions like any other internal link.

The intended purpose is to create a simple template system for semi-standard oft repeated page types. Because the template page itself may contain further relative pagetemplate links, structures of pages can be created.

Syntax

[[[newpagename?templatepagename|Display Name]]]

Yes, those are triple square brackets.

newpagenamename of new pagerequired
templatepagenameAn existing wiki pageoptional
Display Namethe display name for the pageoptional

Example Usage

[[[.new_plugin?templates:plugin_template|New Plugin]]] ;)

Installation

FIXME Wouldn't it be possible to remove the directory “cache/” from the archive.

Don't install in the usual way : the above archive sets an empty “cache” directory that leads you to a “cache” plugin that does nothing. You'd rather refer to Code Listing for manual installation.

Code Listing

To Do

  • Correct the archive (suppress “cache” folder)
  • make it work with last DokuWiki version

Bugs

Not working with version 2008-04-11

Installed fine but the given examples above show with an underline and an extra “]” to the right and when clicked try to generate a page with BOTH the new page name AND template name merged together; the resulting page is blank.

PerryM 4/20/08

+1 : installations says “pluging cache installed” but the triple brackets does the same as before installing the plugin. Good idea though to offer the opportunity to let users make templates, like MediaWiki offers to make “models”. — NewMorning 2008/08/03 12:20
Actually manual install works better : triple brackets are recognized, but the template isn't loaded though… — NewMorning 2008/08/07 15:01
Is there any way to get this plugin working on newer versions of dokuwiki? — tezmanian 2011/03/28 15:44

Comments

Old wine in new bottles?

Dokuwiki offers you the possibility to define templates:

  • create a file called “_template.txt” (in UTF-8) on your hard disk,
  • fill it with the necessary content and upload it in your namespace (maybe you have to put the permission to 766)
  • every time a file in this namespace is created, the template is loaded in the editor-menu.

Usage/ Example: If you want to build a site with recipes and one of your namespaces (folders) reads “lunch”. And the template “_template.txt” with the skeleton for a lunch dish was put in the lunch-folder, every time a file is created in the lunch-namespace, the _template.txt is loaded in the editor-menu, where you can fill it with data. The _template.txt itself is not changed.

Have a try! 8-)

Reply:

Well, perhaps the bottle contains a refined pinot to the robust default cab-sauv. ;-)

The differences from the default mechanism are:

  • Any existing page can become a template. Any non-tech user can make a template on-the-fly within the wiki without needing to fool around on the server.
  • No namepspace restrictions. Templates can be used in all namespaces, and many different templates could be used within the same namespace.
  • Makes it possible to spawn a series of pages in a structure. So if a link is created to
    [[[jobname?templates:newjob]]]

    the template page <newjob> may contain further template links -

    [[[contacts?templates:newcontactpage]]], [[[timeline?templates:newtimeline]]], [[[issues?templates:newissueslist]]]
    

    - and so on.

Green Box 2007-08-28 03:49

Reply:

With regards to _template.txt … you could also symlink template.txt to it and then edit it from within the wiki. Still requires shell interaction, but a little nicer. It will show up in indexmenu lists though, so you could either reorder it or name the symlink ztemplate.txt or something alphabetically insignificant for you application … or … put all such symlinks in another directory with some sane naming scheme. Not saying you should, it just has a few useful applications in my environment. — Ryan 2008-06-12

plugin/pagetemplate.txt · Last modified: 2015-06-24 23:50 by Klap-in