Configuration

Configuration manual for PageSeeder

PSML document template

Overview

There is either zero or one document-template.psml file per document type. This file specifies the following classes of content and structure: 

  • common – this is normal PSML content that exist in identical form in every document of the type. 
  • optional / repeatable – variables or PSML content that has been defined in the template namespace and processed when a new document is spawned or during editing.  Within the constraints of the document template, this content may be different in every document.

See the following links for further information on using the document type to improve productivity (custom editors, document display) and quality (document names and locations, data validation). 

Note

When editing this template file in PageSeeder pressing ctrl-space will display autocomplete options to make editing easier.

Template Namespace

The field and fragment variables in http://pageseeder.com/psml/template (expressed with t:) are as follows:

  • <t:param> – used to declare and label a parameter plus optional characteristics.  These can be prompts to users for input when the document or fragment is created, or they can be system values such as the date and time of creation.
  • <t:value> – injects the parameter value into the document content as the value of an attribute or element.
  • <t:fragment> – declares an PSML <fragment> that can invoked zero or many times by the user editing the document.
  • <t:fragment-ref> – refers to the <fragment> by @type, it is only valid inside a <section> element.

No additional code is required to integrate the document-template.psml. Simply declaring the objects correctly will make them part of the PageSeeder document lifecycle, including editing, search and publishing.

To create a document-template.psml file, use the Document Types page located under the Dev tab in the Developer perspective.

Document-template elements

Document types do not require a document-template. If document-template.psml is not found in:

/WEB-INF/template/[project]/psml/[documenttype]/

any new document for that type will be generated using the settings of the default template.

/WEB-INF/template/default/psml/default/document-template.psml

<t:param>

The <t:param> element allows the document to be populated with values generated at the time the document is created. 

If <t:param> is a child of <document> it will appear on the New Document page. If <t:param> is inside a <t:fragment> element it will appear on the Add Fragment dialog. It can have the following attributes:

AttributeDescription
nameThe parameter name (required)
titleThe title displayed in the user interface (optional).
If not specified then the parameter will NOT be displayed in the user interface.
defaultThe default value (optional)
type

The data type - text|integer|date|xml - default is text (optional).
If the value does not match the data type then the default is used.

When creating new documents PageSeeder will also create the following parameters:

NameDescription
ps.titleThe title from the user interface or as specified by the <creation> options
ps.filenameThe filename of the document
ps.descriptionThe the description entered in the user interface
ps.authorThe first name and surname of the user creating the document
ps.docidThe document ID from the user interface or as specified by the <creation> options
ps.groupThe current group for the document
ps.pathThe path of the document
ps.currentdateThe current date in ISO8601 format
ps.currentdatetimeThe current datetime in ISO8601 format including timezone information
ps.currenttimeThe current time in ISO8601 format including timezone information

<t:value>

 The <t:value> element can be used to insert parameter values into the content and can appear inside any element with text content. It has the following attributes.

AttributeDescription
nameThe parameter name

Inside attributes the value can be inserted using the format {$[name]}.

<t:fragment>

The <t:fragment> element can be used to define fragment types which can be added by users editing the document. Any defined fragment type can be added inside any <section> in the document unless the section has a @fragmenttype attribute which restricts it to one fragment type. It should appear before any <section> elements and have the following attributes:

AttributeDescription
typeThe fragment type
titleThe title displayed in the user interface

It must contain one of the fragment elements: <fragment>, <properties-fragment>, <xref-fragment>, <media-fragment>.

<t:fragment-ref>

The <t:fragment-ref> element can be used to insert fragment types. It must appear inside <section> and have the following attributes:

AttributeDescription
idThe fragment id
typeThe fragment type

 

For further information, see fragment examples or custom documents.

Example

Below is an example:

<?xml version="1.0"?>
<document xmlns:t="http://pageseeder.com/psml/template"
                                            level="portable">  

  <t:param name="difficulty" title="Difficulty" type="integer" />

   <t:fragment type="outcome">
     <fragment>
        <heading level="3">Outcome</heading>
        <para>Type description here</para>
     </fragment>
   </t:fragment>

   <t:fragment type="question">
     <fragment>
        <t:param name="question-id" title="Question ID" />
        <t:param name="question-content" title="Content"
                            default="Type content here"/>
            <para>Question ID:
               <inline label="question-id">
                  <t:value name="question-id"/>
               </inline>
            </para>
            <block label="richtext">Content:
                <block label="question-content">
                  <t:value name="question-content"/>
                </block>
           </block>
     </fragment>
  </t:fragment>

 <section id="title">
     <fragment id="1">
        <heading level="1"><t:value name="ps.title"/>
          </heading>
     </fragment>
  </section>

  <section id="metadata">
    <properties-fragment id="2">
      <property name="author"   value="{$ps.author}"/>
      <property name="created"  value="{$ps.currentdate}"
                                            datatype="date"/>
      <property name="difficulty" value="{$difficulty}"/>
      <property name="topics"   count="n"/>
    </properties-fragment>  
  </section>

  <section id="outcomes" fragmenttypes="outcome">
    <title>Learning Outcomes</title>
    <t:fragment-ref id="3" type="outcome" />
  </section>

  <section id="tutorial">
    <title>Tutorial</title>
    <fragment id="4">
      <para><t:value name="ps.description"/></para>
    </fragment>
  </section>

  <section id="related">
    <title>Related</title>
    <xref-fragment id="5"/>
  </section>

</document>

Created on , last edited on