Tutorials

Task-driven tutorials and recipes for PageSeeder

How to constrain new documents to a specific location or naming rules

Skills required:XML
Time required:15
Intended audience:Developer
Difficulty:Easy
Category:Document

Objective

This tutorial explains how to configure PageSeeder so that any new documents of a specific document type conform to rules that specify where the document must be stored and what it must be named.

Using this capability will reduce the amount of learning necessary for new users, plus improve the data quality and user productivity.

Tutorial

Configuration

The rules that determine where PageSeeder stores documents are stored in the following file in the project:

/WEB-INF/template/[project]/psml/[document-type]/document-config.xml

Under the Dev tab of the Developer perspective, select 'Document config' then either 'Create document type' or edit the document-config.xml file for the appropriate type;

Add the name of the appropriate document-type to the <creation> element;

Edit or add the <folder> element so that it contains the path to the folder where files of that type should be created.

Example

Insert the following code:

<?xml version="1.0"?>
 <document-config>
  <creation [disable="true"]>
   <title> ...</title>?
   <folder... />?
   <filename... />?
   <document... />?
   <description> ... </description>?
 </creation>
</document-config>

Then, insert the configuration specific to your document similar to the example below. This will ensure that all files of type 'movie_information' in your 'movie_database' project are created in your /documents/films folder.

<?xml version="1.0"?>
<document-config>
<creation>
    <title>movie_information</title>
    <folder context="/documents/films" />    
  </creation>
</document-config>

Input and output:

Fig. 1

document-config.xml

tutorials-documentconfig.PNG

Fig. 2

Create a new document

tutorials-createanewdocument.PNG

Note

Extra document fields can be added by entering the following in the document-template.psml:
<t:param name="opening_date" title="Opening Date" type="text" />
The opening date will be automatically populated upon pressing submit (see Fig. 5)

Fig. 3

Document is created inside 'films' folder as per <folder> element

tutorials-documentfolder.PNG

Fig. 4

Document is titled as per <document> element.

tutorials-documentcreated.PNG

Fig. 5

Document view

tutorials-document.PNG

Refer to the article on the <creation> element for more information.

Created on , last edited on