With MindTouch Deki you can create single and multiple page templates and then use the templates to create pre-formatted pages of content. It's really easy.

    What is a template?

    A template is a piece of content, stored in a page of its own (a 'template page'), which can be included in another wiki page using a simple syntax.  The template can be considered like a function in a programming language, in that you define it in one place, and then can reference it from others.


    A template can contain:

    You can either add a template to a page in the editor, or you can call templates dynamically from your page using the Template DekiScript command.

    Why are templates useful?

    Templates are useful for quickly creating similarly formatted pages of content. For example, perhaps every project you do has a similar set of pages. Project summary, timeline, people, meeting notes, etc. By creating a project template it makes creating new project pages quick and easy. Templates also help to provide some level of consistency in pages.  

    If you want to include the same text on each page (such as the popular "This page is a stub" template), consider using a template.  For a user to type {{ Template.stub() }} is much quicker than to type out the entire, formatted string; it means the string appears exactly the same on each page, and it can be edited later.

    Create a template

    Click to Tools > Templates. Alternatively you may browse to http://yourdeki_wiki/Template: , e.g.- Template:  This page lists all the templates available. There may be templates here already - you may browse them by clicking the links to each template.  If you haven't created any templates yet, you'll see a page named "Templates" and the text "Page has no text." Let's create a new template now.  

    Click  "New Page". This creates a new page titled "Template:Page Title". Add content to the template. Change the title of your template to be something indicative of its use. Click  "Save".  If you like to create a multiple page template,  add additional  sub-pages to this template by clicking "New Page".  Add content to these pages and click "Save".

    Add the contents of a template to a page

    To create a page from a template, create a new page  - not in the template namespace (i.e. Template:), but somewhere you wish to take advantage of the template.  You might like to start in a sandbox page while learning. While editing this page click the template icon on the editor toolbar - it looks like this (red arrow is pointing to the template icon):
     

    Template_icon_FCKEditor.png

    Editor toolbar 

    You will then see a list of all the templates available. Select your template. If you select a single page template the contents of this template are injected into the page you are editing. If you selected a multiple page template a list of all the pages, with links to each page, is injected into the page you are editing. Click save.

    Call a template dynamically

    Here's where the fun starts!

    To call a template from a page, such that the content is added when the page is viewed, not when the page is saved, enter something like this:

    {{ Template.Name() }}
    

    Here's an example, showing the Daily Dilbert template:

    This was included automatically like this:

    {{ Template.DailyDilbert() }}

    To call a template with parameters, you usually provide a "map", or key/value pairing.  The StockInfo template takes a parameter "ticker", with a value of a stock symbol.  Instead of parenthesis, you can use curly brackets to include a map.  Let's call the StockInfo template with the parameter "ticker" set to the symbol for Apple:

    {{ Template.StockInfo{ ticker:"AAPL" } }}
    

    Any function which can be written in DekiScript on a page can be put into a template.

    Was this page helpful?
    Tag page (Edit tags)

    Files 2

    FileSizeDateAttached by 
    Template_icon.png
    The red arrow points to the template icon on the editor toolbar.
    7.73 kB21:29, 23 Nov 2008crbActions
     Template_icon_FCKEditor.png
    No description
    7.73 kB21:32, 23 Nov 2008crbActions
    Viewing 4 of 4 comments: view all
    Why does it say I dont have any templates available?
    Posted 17:16, 11 Jan 2008
    Probably you did not create any templates under the template Namespace. See "Create a template" above.
    Posted 19:01, 15 Jan 2008
    Updated page to reflect editor advisory.
    Posted 19:24, 17 Mar 2008
    I was thrown when I got my templates page and it's just empty and not editable. I'll suggest a rewrite. Also, I still don't get the "call a template dynamically" section. What's it doing different from a normal template? Why would I want to do this?
    Posted 17:01, 25 Nov 2008
    Viewing 4 of 4 comments: view all
    You must login to post a comment.
    Powered by MindTouch 2010
    Powered by MindTouch 2010