newpagetemplate Plugin

newpagetemplate plugin by Jason Grout
Loads predefined page content from a given template

Last updated on 2010-01-29. Provides Syntax.
Compatible with DokuWiki 2006-11-06.

Tagged with button, editing, template.

Description

This plugin loads into the new page creation box a template specified in the $_REQUEST “newpagetemplate” parameter. Effectively, this means that you can pass a template page, similar to the namespace template pages, either in the URL or in a POST form to the creation page. Also, you can pass any number of substitution variables in the “newpagevars” variable.

See the addnewpage plugin discussion to see how to modify the addnewpage plugin to take advantage of this feature.

Example

If a new page is created with the URL:

doku.php?id=:mynewpage&do=edit&rev=&newpagetemplate=:pagetemplates:homepagetemplate&newpagevars=@HI@,Howdy!

then the :pagetemplates:homepagetemplate page is pasted into the edit box. If the “standardreplace” configuration option is true, then the substitutions noted below are performed. If the “userreplace” configuration option is true, then you can also replace ”@HI@” with “Howdy!”, as this substitution was passed in newpagevars. The format for newpagevars is: newpagevars=key,value;key2,value2;key3,value3;

Substitutions

As with the _template.txt namespace templates, the following variables are replaced in your template.

@ID@ full ID of the page
@NS@ namespace of the page
@PAGE@ page name (ID without namespace and underscores replaced by spaces)
@!PAGE@ same as above but with the first character uppercased
@!!PAGE@ same as above but with the first character of all words uppercased
@!PAGE!@ same as above but with all characters uppercased
@FILE@ page name (ID without namespace, underscores kept as is)
@!FILE@ same as above but with the first character uppercased
@!FILE!@ same as above but with all characters uppercased
@USER@ ID of user who is creating the page
@NAME@ name of user who is creating the page
@MAIL@ mail address of user who is creating the page
@DATE@ date and time when edit session started

Bugs

Discussion

Could anybody provide me a simple description or example for the usage of the plugin in combination with 'addnewpage'?
Thanks, Matt
When accessing a non-existing page you're provided with a text:
This topic does not exist yet
You've followed a link to a topic that doesn't exist yet. If permissions allow, you may create it by using the Create this page button


It would be nice to add text where the user can choose from different templates, your plugin would then provide the URL to match the name of the page and the user has choice from different templates. Or am I missing something here ?
I have a same question. Can anybody explain me how to use a new page template when adding a page. I am new to PHP and don't know anything. Your help is highly appreciated.
Thanks, George
 
plugin/newpagetemplate.txt · Last modified: 2010/01/31 00:14 by 92.202.61.213
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate