Meta files

Meta files are used for setting and storing properties and additional information that are not immediately related to the content of a document, resp. are not relevant for displaying a document. They include, for example, the following information:

  • the filename of a document
  • the directory in which a document should be saved
  • the template for entering content
  • keywords for search machines
  • publishing and expiry information
  • control information for the workflow
  • additional information about the publishing
  • control information for the workflow

A lot of this information for a documents is already inherited from the category it was generated in, for example, the template and directory to be used, see chapter Categories in the administration documentation.

During the MetaEdit workflow step, the system generates an input similar to the imperia template from the defined meta file. When a user edits this step, he or she receives the appropriate form with the defined in the meta file inputs and select elements.

Meta files generate input and selection elements that must be processed by a user. Besides these visible elements, meta files can include reference elements for creating and storing meta variables without user interaction. Control structures (for example, IF conditions) for checking conditions are also available.

Which meta file should be used is defined in the category settings. When processing the MetaEdit workflow step, the input mask can display the meta variables, predefined in the category. All information entered in the input mask of a meta file are stored in the document.

The administration of meta files is done in the meta file management. Detailed information on configuration can be found chapter Meta Files in the administration documentation.



Meta files' structure#

The input mask of a meta file provides a number of display, control and assignment elements. They can be used for displaying already existing information or give users the ability to enter information. These elements are well-known form elements such as:

  • Input fields

  • Drop down lists

  • Checkboxes

  • Multiple Selection Lists

A description of all elements can be found in the section Syntax Reference in this chapter.

The information that a user enters in a control element are stored in a variable, unambiguously identifying this control element. The name of the variable is determined by the name of the control element.

Apart from the above mentioned elements, you can also use control structures, such as IF conditions, in order to conditionally assign a value to a variable.

See the example of a meta file below:z

TITLE "first meta file"
AUTHOR "John Doe"
HELPTEXT "Please enter a title for this document."

#IF ("<!--XX-METAMODE-->")
 HIDDEN "directory:<!--XX-directory-->/<!--count-->"
  PRINT "created file: <!--XX-directory-->/<!--copycount-->/index.html"
#ELSE
    PRINT "created file: <!--XX-directory-->/index.html"
#ENDIF

INPUT "35:title::Please enter title:"
  • contains the title, that you see in the meta file management (see chapter Meta Files in the administration documentation).

  • contains the name of the author of the meta file. It is only for information purposes and is not important for the further course of a workflow.

  • a help text, that is displayed while entering information into the mask.

  • an IF condition, that conditionally fills the directory variable, depending on the document mode. The first branch of the instruction is only executed, when the corresponding document is in META mode (see Document Modes).

  • generates the path to the document. It consists of the value <!--XX-directory--> , the path under which all documents of the corresponding category are stored and a number that is automatically generated with <!--count-->.

  • displays the already generated path, including the filename. With <!--copycount--> one can refer to the last generated number with <!--count-->. In this case this is the directory name generated in the line above.

  • instructions in this branch are only executed, when the document in question is not in META mode. In this mode, the complete path to a document, including the filename, is displayed. The directory that has been automatically created in META mode and extends the directory for this category, can be read within all following executions of the MetaEdit step via <!--XX-directory-->. It must, therefore, not be explicitly referenced in META mode.

  • an INPUT field for a user to enter the title of a document.



General Syntax#

Every selection or input element in a meta file defines a new variable or changes an already existing one. To every selection or input element a keyword and a series of parameters exist. The individual parameters can be found in Syntax Reference.

Keywords are generally written with capital letters, the parameters assigned to them are placed in quotes and are separated from each other by colons. Even when a parameter is not used (for example the default value) there must be a colon.

With the following row we generate an input field. The user's input is stored in the variable keywords.

INPUT "60:keywords::Keywords"

The key word INPUT generates an input field. Then, the width of the input field (60) is defined, followed by colon.

Following, is the name of the variable - in this case keywords:. In this example, there is no default value for the variable, so there is another colon after keywords:.

Last, “Keywords” is the descriptive text that is displayed in the input mask of the meta file next to the input element.

Other input elements behave in a similar way. Refer to Syntax Reference.

Alternatively, variables can also be defined as hidden. This method can be used, for example, in order to specify a template, target directory, or a filename that should be used for a document. The syntax is as follows:

HIDDEN "filename:index.html"
HIDDEN "directory:/docs/news/<!--count-->"
HIDDEN "template:myImperia"

Refer also to Hidden Assignments.



Syntax Reference#

From the described syntax, imperia generates an HTML form with the known input and selection fields.


Input Fields#

You can generate variables and store them with the help of input fields. The values of a variable are available at any place in the workflow and the information contained within can be read out, modified or otherwise processed.

The syntax for an input field is as follows:

INPUT = "Number:Variable:Value:Description"

The placeholders in the above mentioned example are replaced as follows:

  • number sets the desired display width of the input field in the input mask.

  • variable sets the name for the variable that should contain a value entered by a user.

  • value sets a default value. It is stored in the variable when a user leaves the field empty.

    Note

    If you want to use the content of a variable, it should be escaped, for example in the following manner: INPUT = "60:title:<!--XX-META:title-->:Title"
    Otherwise there is a possible data loss, if the variable value contains quotes.

  • Description sets the text that is displayed in the input mask as description next to the input field.

Example:

INPUT = "60:keywords:Bundesliga, soccer:keywords for search engines"

This line generates an input field with a width of 60 characters, used to fill the variable keywords. If a user makes no entries, the default value "Bundesliga, soccer" is taken.

The content of this variable can be accessed at any point in a workflow via the syntax <!--XX-keywords-->.


Hidden Assignments#

Hidden assignments are used in order to fill in a variable, without the necessity or possibility of user input.

The keyword for a hidden assignment is HIDDEN. The expected parameters are name and value.

HIDDEN "Variable:Value"

Example:

HIDDEN "filename:default.htm"

In this example the value default.html is assigned to the variable filename.


IF Conditions#

Conditional expressions can be evaluated with IF conditions. Depending on the condition, variables can be changed.

A possible application is the generation of a directory depending on a document's mode:

#IF ("<!--XX-METAMODE-->")
    HIDDEN "directory:<!--XX-directory-->/<!--count-->"
#ELSE
    HIDDEN "directory:<!--XX-directory-->"
#ENDIF

With a drop down list, a user can select one of various preset options from a list. Each option assigns a different value to the variable, filled through a drop down list.

The syntax for a drop down list is as follows:

SELECTION "meta variable:description"
    OPTION "value 1:text 1"
    OPTION "value 2:text 2"
    OPTION "value 3:text 3"
    OPTION "value 4:text 4"
ENDSEL

This example uses placeholder that should be replaced.

  • Meta variable sets a name for the variable that should be filled.

  • Description sets text that should be displayed in the input mask next to the drop down list.

  • value 1 to value 4 set the values that the variable should take upon selection of the corresponding option.

  • text 1 to text 4 set the text that should be shown for the corresponding option in the drop down list.

Example:

SELECTION "bgcolor:background color"
    OPTION "#FFFFFF:white"
    OPTION "#000000:black"
    OPTION "#FF0000:red"
ENDSEL

In this example, the background color can be selected and stored in in the variable bgcolor. Then, this color can be set as the background color of the document:

<body bgcolor="<!--XX-bgcolor-->">
...

Multiple Selection Lists#

With the help of a multiple selection list, a user can select several options from a number of options.

The syntax for a multiple selection list is as follows:

MULTIPLE_SELECTION "number:meta variable:description"
    OPTION "value 1:text 1"
    OPTION "value 2:text 2"
    OPTION "value 3:text 3"
    OPTION "value 4:text 4"
ENDSEL

This example uses placeholders that should be replaced.

  • number sets the number of lines in the multiple selection list.

  • meta variable sets a name for the variable that should be filled.

  • description sets the text that should be shown in the input mask next to the multiple selection list.

  • value 1 to value 4 set the values that the variable should take upon selection of the corresponding option.

  • text 1 to text 4 set the text that should be shown for the corresponding option in the drop down list.


Checkboxes#

With the assistance of checkboxes, a user can activate or deactivate options.

The syntax for a checkbox is as follows:

CHECKBOX "name:value:left-hand text:right-hand text:parameter"

This example uses placeholders that should be replaced.

  • name sets a name for the variable that should be filled.

  • value sets a value that should be stored in the variable.

  • left text sets the text that should be shown in the input mask to the left of a checkbox.

  • right text sets the text that should be shown in the input mask to the right of a checkbox.

  • parameter sets an arbitrary string that preselects a checkbox.

Example:

CHECKBOX "lang_en:1:language:english:selected"
CHECKBOX "lang_de:1:language:german:"
CHECKBOX "lang_fr:1:language:francais:"

This code generates three checkboxes that allow a user to select language versions. The first checkbox is selected by default (instead of the string selected you can use an arbitrary string).


Radio Buttons#

With the help of radio buttons, a user can select an option from a number of options. Multiple radio buttons can be grouped by the name of the variable. In this way a previously selected radio button is deactivated by selecting another radio button.

The syntax for the radio buttons is as follows:

RADIO "name:value:left-hand text:right-hand text"

This example uses placeholders that should be replaced.

  • name sets a name for the variable that should be filled.

  • value sets a value that should be stored in the variable.

  • left text sets the text that should be shown in the input mask to the left of the radio button.

  • right text sets the text that should be shown in the input mask to the right of the radio button.

  • parameter sets an arbitrary string that preselects a radio button.

Example:

RADIO "radio:0:weather:rainy:"
RADIO "radio:1:weather:sunny:selected"
RADIO "radio:2:weather:foggy:"

This code generates a group of three radio buttons from which the middle one is preselected (instead of the string selected you can use an arbitrary string).


Template Selection#

With the help of the template selection, a user can select the template to be used. This selection is stored in the template variable.

Note

A template selection is not necessarily needed in this step, since a template has already been specified in the category definition.

When a user selects a category in order to create a new document, the variable template is filled with the name of the template setting in the category.

The syntax for a template selection is as follows:

TEMPLATESELECT "X,Y,Z"

The syntax example uses placeholders. You should replace X , Y and Z with the numbers or names of your templates.

Example:

TEMPLATESELECT "01,911,1002,myTemplate"

This line of code generates a drop down list where the descriptions of these templates are displayed. The user can select an entry and the system will use the corresponding template for the new document.

Important

Specify at least one template. An empty template selection in the meta file causes an error.


Language Selection#

When content should be published in multiple languages, you can use the multilanguage solution implemented in imperia. Refer to Managing multilanguage documents for a detailed instruction for this feature. The language selection for a document can be performed in the MetaEdit step. The following line has to be present in the meta file in order to enable language selection:

MULTILANG_SELECTION

This instruction generates a list of all available languages. In the input mask the list is represented by a country's national flag and a checkbox to select it. imperia, then, automatically generates a copy page for every language (see copy). For this particular case, however, the copy instruction is not necessary in the meta file.

The content for the different language versions can be entered in the Edit step of a document. Refer also to Entering Content in Multiple Languages. Which language versions are available for selection can be specified with the linguas meta variable. Enter the desired languages with their respective ISO 639 language code (de, en, fr, etc.). Refer also to Editing Categories in the administration documentation.


Help Text#

The help text is used for explaining an input mask to a user.

The syntax for the help texts is as follows:

HELPTEXT "This is a hint for you"

This code generates a separate help text. The help text is not automatically wrapped. Longer help texts must be distributed over multiple lines.


Comments#

In order to comment particular sections of the code in the meta file, you can use the following syntax:

// This is a comment

Every comment line must start with two slashes.


Automatic Expiry, Publishing and Resubmission#

You can automatically publish, resubmit and delete documents. Define the date and time for these actions in a meta file with special input elements. The entered values are stored by imperia in the variables publish_date, resubmission_date and expiry_date.

For compatibility reasons, imperia always expects a user's local time with the variables publish_date, expiry_date and resubmission_date and then internally converts it to GMT. If you later want to edit that date, imperia converts the date from GMT back to the user's timezone and represents the date correctly.

Important

imperia behaves differently with custom date fields. Please see Date Specification For Arbitrary Meta Fields.

Note

The meta variables publish_date, resubmission_date and expiry_date can be set, resp. changed everywhere in a workflow, for example with the Meta-Setter plug-in. So you can define these dates and times in this step, different than the MetaEdit one.

In the meta file you should write the following:

PUBLISH_DATE "description"

for the input element, specify a publishing date,

RESUBMISSION_DATE "description"

for the input element, specify a resubmission date and

EXPIRY_DATE "description"

for the input element, specify an expiry date.

In the input mask you can see an icon that can be used to open the calender tool.

Calendar tool

You can preset the time offset, resp. the date specification. Refer also to Setting a Default Date. The preset date is displayed next to the calender icon. Instead of the placeholder description you should enter a descriptive text. Example:

// Publishing date with preset values
    PUBLISH_DATE "Publishing date:2011-11-23 23:05"

The above code example generates the following image in the meta edit step:

Publishing date specification


Setting a Default Date#

You can influence the default time offset for automatic publishing and expiry dates. The following options are available:

Fixed date selection

A fixed date indication should be notated in the following form:

PUBLISH_DATE "Description:YYYY-MM-DD HH:MM"

EXPIRY_DATE "Description:YYYY-MM-DD HH:MM"

You can change the date, using the calender tool in the MetaEdit step.

Date selection with offset

A more flexible variant than entering a fixed time is using an offset. This can be defined with the command Xstrftimeoff:

PUBLISH_DATE "Description:<!--Xstrftimeoff:offsett:Locale:%Y-%m-%d %H %M-->"

EXPIRY_DATE "Description:<!--Xstrftimeoff:offset:Locale:%Y-%m-%d %H %M-->"

Define the desired offset in the offset variable. This consists of an operator, a number and an optional unit. Possible operators are plus and minus signs. The possible units are specified in the following table:

Unit Explanation
Y years
M months
W weeks
D days
h hours
m minutes

If you don't enter a unit, the system automatically assumes seconds. Instead of the placeholder local enter the country specific date format, for example, de_DE for the German date format or en_EN for the English one.

Example:

PUBLISH_DATE "Description:<!--Xstrftimeoff:+1h+30m:en_US:%Y-%m-%d %H %M-->"

With the above instruction, the document will be published an hour and 30 minutes after its creation.

These time instructions cannot be changed outside of a workflow.

When reimporting a document from the Archive, there is no need to adjust the publishing date, since the system publishes documents immediately if their publishing date lies in the past.


Other Presettings#

You can use all possible processing instructions for the calender tool in a meta file.

Example:

//The following code is wrapped for representation purposes
PUBLISH_DATE = "label=Auto publish date:startDate=<!--Xstrftime:C:%Y-%m-%d %H:%M-->:
    startYear=2007:endYear=2009"

A list of the possible parameters can be found in Data Entries with the Calender Tool .


Date Specification For Arbitrary Meta Fields#

You can also store date information in arbitrary meta fields and specify the publishing and expiry dates via the calendar tool. Create the corresponding input element with the following instruction:

DATE "Name:Description"

The name of the meta field is set with the name parameter.

Important

Unlike with the variables publish_date, expiry_date and resubmission_date, imperia expects GMT time with custom date fields and then automatically converts it to a user's local time. This should be taken into account as it results in the system adding the time difference between GMT and a user's local time zone.

Example:

// This is not recommended
DATE "__2:myDate:<!--Xstrftime:de_DE:%Y-%m-%d %H:%M-->"

In the example above <!--Xstrftime--> generates local time, but imperia expects GMT. If GMT is 14:00 and local time is GMT + 2:00 the system will convert it, add the difference between the user's time zone and GMT and display 18:00 when in reality it's 16:00.

To avoid this you should use <!--XstrftimeGMT--> which generates GMT. imperia converts that to browser time and displays it.

//recommended
DATE "__2:myDate:<!--XstrftimeGMT:de_DE:%Y-%m-%d %H:%M-->"

Text Output#

You can read out information using the following syntax:

PRINT "descriptive text:desired data"

The information is read out in the input mask in two columns, in which the left column is always printed in bold and the right column is always printed normally. These two columns are divided by colon. This results in the following possibilities for design:

Possibilities for Configuration With PRINT
Colon at the very left: PRINT ": ..." The entire text in the right column is displayed in normal typeface.
Colon dividing the text into two parts: PRINT "... : ...". The text to the left of the colon is printed bold in the left column, the text to the right of the colon is normally printed.
Colon to the very right or no colon: PRINT "... :". The entire text is printed in bold in the left column.

Example:

PRINT "Today is :<!--DATE:day-->"

The result in the input mask is as follows:

Result of a PRINT instruction in a meta file


HTML Code Output#

With the instruction HTML you can output HTML tags.

HTML "<img src='/images/template_screenshots/news.png' />"

You can, for example, integrate preview pictures for the selectable templates in the meta file (see Template Selection).


JavaScript in Meta Files#

It is also possible to execute JavaScript when completing a MetaEdit step. The JavaScript code for this can be integrated in the meta file with the instruction ONSUBMITSRC.

ONSUBMITSRC "/path/to/file.js"

Note

You have to define the function function onSubmit(event); within the JavaScript. For example:

javascript
function onSubmit(event) {
return confirm("Do you want to save?");
}

Reading User Data#

With this function it is possible to read the current user's data from the user management and store it in a variable.

Note

This user information can also be read and stored in a variable within a template.

The syntax is as follows:

<!--USER_CONF:Field-->

Caution

The old syntax with hyphen (USER-CONF) is no longer supported!

The following fields can be used instead of the placeholder field:

name content
id user id
homepage homepage
country country
telnumber phone number
language language (de, de_DE, ...)
cellular cellular
name name
fname fname
city city
zip zip
zip zip
login login
email email
street street
comment comment

Example:

PRINT "You are logged in as:<!--USER_CONF:login-->"

Reading System Parameters#

You can also read out and store in a variable system parameters. All parameters that are defined in the file /site/config/system.conf can be accessed.

The syntax for reading system parameters is as follows:

<!--SYSTEM_CONF:Parameter-->

The placeholder parameter must be replaced with the name of the corresponding parameter from the system.conf file.

Example:

PRINT "document root:<!--SYSTEM_CONF:DOCUMENT-ROOT-->"

A list of all configuration parameters can be found in the section System Configuration Variables of the Administration Documentation


Reading Category Properties#

Various properties of the category in which the document is created can be read from the meta file and stored in a variable.

The syntax is as follows:

<!--SECTION:Keyword:Category level-->

The following keywords can be used:

NAME
The name of a category.

DESCR
The description of a category.

DIRECTORY
The directory that has been specified in a category.

TEMPLATE
The template which is set in a category.

FILENAME
The filename of generated documents, that is specified in a category.

You can also overwrite the values of the keywords DIRECTORY, TEMPLATE and FILENAME in the meta file. This function, however, accesses the corresponding values from a category. You should use these keywords only when you can guarantee, that the values from the category are not changed elsewhere.

If only the lowest level of the category should be queried, don't indicate it in the instruction:

<!--SECTION:NAME-->

Example 1

Let's assume that there is a main category movies with a subcategory action, which has a further subcategory martial arts.

In order to get the name of the subcategory action, enter the following code:

PRINT "Sub category:<!--SECTION:NAME:2-->"

Example 2

Let's assume that for each category, there is meta information with the name of the author. With the expression

PRINT "Category author:<!--SECTION:META_INFO_author-->"

the value of this meta field is read out in the meta file.


Reading a Document's Path#

You can read parts of a document's path. The name of the desired directory is stored in a variable.

The syntax is as follows:

<!--dirlevel:xxx-->

The placeholder xxx must be replaced with the value of the position of the desired directory in the path. The positions start with the top-level directory, which is referenced by the value 1.

Example

Let's assume that an article is in the directory /sport/June/16. The code row

PRINT "This article was created <!--dirlevel:2--> <!--dirlevel:3-->"

generates the following in the input mask:

This article was created June 16.

Insert Date and Time#

imperia offers a lot of ways to store different date and time formats in a variable.

The syntax is as follows:

<!--Xdate:Format-->

The placeholder format can be replaced with one of the following:

format result
default 15.08.2005
full 15.08.2005
inverse 2005-08-15
afiles 2005-08-15 12:31
iso 20050815
normal 15.08.2005
american 08/15/2005
imperia 15.08.2005 12:31
finddate 2005.08.15 12:31

A date can be given in an INPUT field as a default value:

INPUT "44:date:<!--Xdate:default-->:Date"

In order to just print the date, use the following syntax:

PRINT "Date:<!--Xdate:default-->"

Access to Date Elements#

To access particular date elements such as day, month or year use the following syntax:

<!--DATE:date element-->

The placeholder date element is replaced with one of the following elements:

element result
day gives the day numerically
month gives the month in clear text
mon gives the month numerically
year gives the year

Example:

PRINT ":The year is <!--DATE:year-->"

Time Formats#

In order to store time in a variable, you should use the following syntax:

<!--Xtime:Format-->

The placeholder format is replaced with one of the following elements:

element result
default 12:31
normal 12:31:22
full 12:31:22
compact 12:31
hour 12
minute 31
second 22

Example:

HIDDEN "time: <!--Xtime:compact-->"

Localized Date and Time#

You can use the following syntax to format date and time via the system function strftime:

<!--Xstrftime:Locale:Format-->

The placeholder local is for the system dependent LOCALE variable. Refer to the documentation of your system.

Example:

<!--Xstrftime:en_UA: Today %A, %B %d %Y.-->

This line becomes:

Today is Tuesday, January 6 2004.

Note

HTML markup (less than, greater than, ampersand, double and single quotation marks) that is included in the string and returned by the strftime function is escaped correctly.


Localized Date with Offset#

In order to get a future or past date, resp. a future or past time, you can use offsets. The syntax is as follows:

<!--Xstrftimeoff:Offset:Locale:Format-->

The placeholders local and format have to be replaced. The placeholder offset is available for an arbitrary number of parameters in the form operator value unit.

The following operators are available:

operator function
+ adds the value to the current date/time
* subtracts the value from the current date/time

The following values can be used:

parameter meaning
s seconds
m minutes (always 60 seconds)
h hours (always 3600 seconds)
D days (always 86400 seconds)
W weeks (always 604800 seconds, e.g. 7 days)
M months (always 2592000 seconds, e.g. 30 days)
Y years (always 378432000 seconds, e.g. 365 days)

Leap seconds and leap days are ignored, as well as the different numbers of days of the month within a year.

Examples:

code effect
+1W-1D Today plus one week minus one day
600 Now plus 600 seconds
+1M Today plus one month

The underlying algorithm tries to return the expected result. If on a 13th day of a month one specifies an offset of three months, the result is the 13th day of the corresponding month. If the target date does not exist (e.g. 31st February), the first existing day prior to the target date is returned.



Functions and Constants in Meta Files#

Below you will find a list of all functions and constants that can be used in meta files. In general all functions must be enclosed by comment signs.

Example:

<!--count--> 

copy#

In fact, copy is not a function but a special meta field that is, for example, filled with a HIDDEN instruction. Since you initiate the generation of copy pages by the use of this meta field, it can also be seen as a function. The content of the copy field contains several parameters with which you can control the generation of a copy. For each copy element imperia generates a different document, resp. a different file. This happens, when the main document exits a workflow.

The copy pages contain all meta information of the original main document, which is also referred to as Master document. Which parts of the information should be shown in which copy can be specified in the corresponding template. The information for all copies is collected while the master document runs through a workflow. Only at the end, when a document exits its workflow, the content is distributed to the individual copies.

If a document is in the Edit step, an additional selection is available. With this selection, you specify whether the preview should show the master document or one of its copies.

Note

The copy instruction must not necessarily be set in the MetaEdit step. You can also generate the corresponding meta field in the Edit step of a workflow and you can fill it, for example, with hidden form fields in a template. Bear in mind, however, that the MetaEdit functions count, resp. copycount, are not available.

In a copy instruction, you can specify a number of further parameters along with the filename of the copy page. These can be given as key value pairs. The values must be URL encoded. A key can only have one value. If there are multiple values specified, only the last value is used.

The syntax for a copy instruction is as follows (this snytax is an exception to the rule of only using comment signs, as mentioned above):

HIDDEN "copy[Suffix]:path/filename.end:[parameter]"

suffix

Optionally the instruction copy can have a suffix consisting of all alphanumerical characters. Using a suffix will suppress the selection of a copy in the document preview.

Path and filename

Enter the desired path and the filename for the copy page. Please make sure that filenames are unique.

Tip

The functionscount (see copycount:Counter File) are frequently used.

TEMPLATE

This parameter is used to specify a template for the copy page. You can either specify a special template or you can use the template of the master document.

Important

Bear in mind that imperia performs the assignment of information to the copies by the names of the meta fields.

By default the template name is shown as the label for the corresponding copy in the preview selection in the Edit step.

publish_date

The publish date of a copy page can be determined with the publish_date parameter. imperia stores the entered value in meta fiels with the same name. The indication of the date must be done in the form JJJJ-MM-TT+HH%3aMM. The space between the date and time specification, as well as the colon between the hours and the minutes are already URL encoded.

Note

The values notated at this place can be overwritten in subsequent workflow steps.

expiry_date

With this parameter you can determine the expiry date of a copy page. The date format corresponds to the publishing date format (see Setting a Default date). imperia stores the entered value in the meta field with the same name as the copy page.

Note

The values notated at this place can be overwritten in subsequent workflow steps.

__imperia_preview_select_name

When you generate all copies with the same template, this parameter makes it possible to assign an individual name to the various copy pages in the preview selection field. An example for copy pages with identical template and different name in the preview selection:


    //The following code is wrapped for representation purposes
HIDDEN "copy:<!--XX-directory-->/de_<!--KK-filename-->:TEMPLATE=_multilang_de_en_fr:
    __imperia_preview_select_name=deutsch"
HIDDEN "copy:<!--XX-directory-->/en_<!--KK-filename-->:TEMPLATE=_multilang_de_en_fr:
    __imperia_preview_select_name=english"
HIDDEN "copy:<!--XX-directory-->/fr_<!--KK-filename-->:TEMPLATE=_multilang_de_en_fr:
    __imperia_preview_select_name=francais"

When you set this parameter to none, the corresponding copy page is hidden in the preview field. The master document can be hidden in the selection field in the following way:

HIDDEN "__imperia_preview_select_name:none"

Note

Make sure that only copy pages with 'copy' are made availabe as a preview in the template.
Copy pages as e.g. 'copy_foo' are not taken into account.

Arbitrary Meta Field

Apart from the previously mentioned parameters in a copy instruction, you can define arbitrary meta fields for a copy page. These can be used, for example, as publishing triggers.

Important

Meta information set into a document by a copy instruction, is only present in the corresponding copy when the template processor has completed the copy page generation.

You always see and edit the master document in a workflow. Information specific to a particular copy cannot be accessed there. Also, the meta viewer only shows you the meta information of the master document. When you wish to check the specific information of a particular copy, you must display them in the preview.

Example

Note

The text in this example is wrapped because of presentation reasons.

HIDDEN "copy_de:<!--XX-directory-->/<!--copycount-->/de_<!--XX-filename-->:
                TEMPLATE=_multilang_de_en_fr:publish_date=2007-01-22+12%3a22:
                expiry_date=2008-01-22+12%3a22:intranet=1"

In practice, copy pages are often used when creating multi language documents. An example can be found in the appendix under Copy Pages Multiple Language Documents Examples.


count#

Generates a continuous numbering, which grows with every selection of the variable. If this function is used for generating the directory name, one must additionally include an IF condition, which checks the document mode. Refer to Counter in the Directory Name.

Note

If a user updates the browser window (F5 resp. Ctrl+R), the numeration is increased. However, no new documents are created. This variable is preferably used in the meta mode of a meta file.


count: counter#

Generates a numeration which is increased with every incremental step by <number>.

Example:

<!--count:5--> 

increments the counter by 5.


count: count file#

This function uses a different counter file than the standard one. The counter files are located in /site/counter. The present files should not be changed. Instead, you must specify a new counter file with an arbitrary name without a filename extender.

The syntax for using a counter file is as follows:

<!--count:filename-->

The structure of a counter file is as follows:

$start = '1'
$increment = '1'
$minvalue = '1'
$maxvalue = '2147483647'
$cycle = '1'
$currval = '41'
keyword meaning
$start Contains the start value.
$increment Contains the step-width.
$minvalue Contains the value with which the counter restarts after a completed cycle (if $cycle =1).
$maxvalue Contains the maximum value that can be assigned to a counter.
$cycle Determines if the counting mechanism restarts with $start , if the counter has reached $maxvalue . It can have the values 0 or 1 .

copycount: Counter File#

This function is similar to the count function, but it does not have counter incrementation. When you use this function for assembling a directory, you must additionally include an IF condition, which checks the document mode. Refer to Counter in the Directory Name.

The syntax is as follows:

<!--copycount:filename-->

Example:

    #IF ("<!--XX-METAMODE-->")
        HIDDEN "directory:<!--XX-directory-->/<!--count-->"
    #ELSE
        // No need to set the hidden field again if not first run.
    #ENDIF

    #IF ("<!--XX-METAMODE-->")
        PRINT "All languages:<!--XX-directory-->/<!--copycount-->/all.html"
        PRINT "English:<!--XX-directory-->/<!--copycount-->/index.html.en"
        PRINT "Deutsch:<!--XX-directory-->/<!--copycount-->/index.html.de"
        PRINT "Français:<!--XX-directory-->/<!--copycount-->/index.html.fr"
        PRINT "Italiano:<!--XX-directory-->/<!--copycount-->/index.html.it"
        PRINT "Nederlands:<!--XX-directory-->/<!--copycount-->/index.html.pt"
    #ELSE
        PRINT "All languages:<!--XX-directory-->/all.html"
        PRINT "English:<!--XX-directory-->/index.html.en"
        PRINT "Deutsch:<!--XX-directory-->/index.html.de"
        PRINT "Français:<!--XX-directory-->/index.html.fr"
        PRINT "Italiano:<!--XX-directory-->/index.html.it"
        PRINT "Nederlands:<!--XX-directory-->/index.html.pt"
    #ENDIF

no_publish#

This function controls whether or not a document should be published. The function fills a variable with the same name that is queried by the system. If the variable is empty or if it has the value 0, the document is published. Every other value of the variable leads to the document not being published, or respectively that no document will be generated and stored in the document root of the web server.

You can, for example, manage if the master document, should also be published together with a number of copy documents.


fullyear#

This constant returns the current date in the format YYYY.


year#

This constant returns the current date in the format YY.


fullmon#

This constant returns the plain text name of the current month (January, February, ...).


mon#

This constant returns the current month as a decimal number in the format MM.


day#

This constant returns the current day of the week as number in the format DD.


fullday#

This constant returns the plain text name of the day of the week (Monday, Tuesday, ...).


hour#

This constant returns the current hour as a number in the format hh.


minute#

This constant returns the current minute as a number in the format mm.


second#

This constant returns the current second as a number in the format ss.



Applications#

This chapter explains some frequently used in meta files functions.


Counter in the Directory Name#

Sometimes it is necessary to store each generated document in its own directory, for example, when that document contains more recent news in the same category, and one does not want to overwrite an older news with a newly published document.

There are two ways to ensure that the documents in one directory do not overwrite each other.

The first is to insert this line of code into the meta file:

HIDDEN "directory:<!--SECTION:DIRECTORY-->/<!--DOC_ID:%06u-->"

In this case by using the document's ID you ensure that the filename will be unique.

The other way is to extend the already configured directory with a further directory level, the name of which is generated by a counter.

Because users can execute the MetaEdit step multiple times, you must avoid the counter that generates a directory to be incremented again. Therefore, generating the directory is encapsulated inside of an IF condition.

The following code checks if the document is in META MODE. A document is only in this mode when it passes the MetaEdit step immediately after its creation (see also Document Modes). A document is, however, not in META MODE, if it is returned to this step via the workflow by a user.

Example:

#IF ("<!--XX-METAMODE-->")
   HIDDEN "directory:<!--XX-directory-->/<!--count-->"
#ELSE
   HIDDEN "directory:<!--XX-directory-->"
#ENDIF

Note

If a new meta file is generated via the user interface (see Create new meta file in the admin doc.) the new meta file contains such an IF condition. Of course, not only the counter functionality, but also the node ID of a document can be used in order to generate unique filenames.


Setting a Filename in the MetaEdit Step#

If you want to allow authors to set the filename of a document themselves, the simplest solution for this is an input field in the meta file. The filename of a document is stored in the filename variable. This variable is preset via the category settings.

INPUT "30:filename::Desired new filename"

When storing the entered meta information, the name given by the author overwrites the preset value from the category settings. The new filename is then shown on the Desktop. This simple solution, however, has some disadvantages. The input field cannot be preset with its own text. The filename form the category will always be displayed in the MetaEdit step. Furthermore, HIDDEN instructions cannot be used to assign a filename to the field in the MetaEdit step, when the author changes the contents of this field simultaneously. Likewise, you cannot, for example, use the function count for appending a counter, in order to guarantee unique filenames.

//Does not work:

INPUT "30:filename:Please enter filename and extender:Desired new filename"
HIDDEN "filename:<!--count--><!--KK-filename-->"

Neither the presetting of an INPUT field, nor the appending of a counter with a HIDDEN instruction are evaluated. Only the text entered by the author is stored in the variable. But with a little trick you can achieve this functionality:

INPUT "30:new_filename:Please enter filename without extender:New filename"
HIDDEN "filename:<!--KK-new_filename--><!--count-->.htm"

Define an additional meta field in the meta file, and let the author change its content by a preset input field. In the code example above this is the meta field new_filename. After that you assign the content of this meta field to the field filename with a HIDDEN instruction. In the same instruction you generate a unique counter with the function count and append the filename extender.

Since the HIDDEN instruction is the only access to the filename, this variant works well. As soon as the author exits the MetaEdit step with save, the new filename of the document can be retrieved on the Desktop.

Tip

It's better to use a reasonable default for the new filename in case the user forgets to enter a name.

Note

Remember that you have to use a KK-variable (see KK variables) in order to make a value available when saving. Furthermore, keep in mind that allowing the user to specify a filename has some risks concerning validity and unambiguousness (special characters, spaces, etc.).

Examples#

Copy the files in /site/sample/metafiles, after that, go to /site/metafiles and enter one of the Meta file names in a category.

  • /site/sample/metafiles/standard_multilang.meta With this meta file, only one document can be created per category.

  • /site/sample/metafiles/standard_multilang_counter.meta With this meta file, more than one document can be created per category.