MindTouch Developer Center > Deki > FAQ > Page Management > How do I...Create and insert a template?

How do I...Create and insert a template?

Table of contents
No headers

NOTE:  These instructions uses the modifier SUBST.  SUBST functionality is replaced by SAVE or EDIT in Deki version 8.05 and higher.

  

A template is a page that can be inserted into another page.  Templates provide a convenient mechanism for setting up boilerplate content on your wiki.  To create a new template:

1.  Select Tools->Templates.

./Image1.JPG
Figure 1

2.  Click the New Page button to open a new template in the editor.

3.  Enter the template name and content.   The following example creates a template titled "FAQ Entry":

./Image2.JPG
Figure 2

UP to Deki 1.9.0 NOTE:  The example template uses {{SUBST:user.name}} and  {{SUBST:date.now}} to display the username and date at which the FAQ was created.  The SUBST: prefix is important; without it {{user.name}} and {{date.now}} would not get replaced on save and would always show the current username and date.

Deki 8.05 and higher NOTE:  The example template uses {{SAVE:user.name}} and  {{SAVE:date.now}} to display the username and date at which the FAQ was created.  The SAVE: prefix is important; without it {{user.name}} and {{date.now}} would not get replaced on save and would always show the current username and date.

4.  To use the template, open the destination page in the editor and click the Templates button.

./Image3.JPG
Figure 3

5.   Select the template from the list.

./Image4.JPG

Figure 4

6.  At this point, you will see the contents of the template appear in your page.  Add your data into it and save the page.

./Image5.JPGEditor View ./Image6.JPGAfter Save

  

  

Tag page
Viewing 3 of 3 comments: view all
The SUBST bit doesn't work for me, I always get the current logged in user and current time when viewing the page. Also the time always in GMT, even though the server time is in a different time zone.
Posted 23:35, 6 May 2008
Starting in Deki 8.05 SUBST has been removed. EDIT: and SAVE: have more than replaced the SUBST: functionality.
Posted 00:43, 12 Jun 2008
This looks super easy. I was slightly confused by the nomenclature. In MODx, boilerplate content similar to this are called "chunks." To me the word template sounds like it is more global and permanent.
Posted 09:07, 4 Oct 2008
Viewing 3 of 3 comments: view all
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2