Data containers form the basis of the SAPI language. It is the content of the containers that defines the scenarios of functional solutions for a document of a SAPI-based CMS. There are three types of containers in the SAPI language: query containers (SAPI:QC), static data containers (SAPI:SDC), and dynamic data containers (SAPI:DDC).
3.3.1 Query Containers
Query containers (see Model of a Managed Site) refer to the fragments of the document displayed on the site; the content of these fragments can be modified by the CMS administrator. The containers contain the code of user data queries and related formatting. The query code is provided in the syntax of the markup language of the presentation code. For example:
|
<sapi:apply exp="eq('this.this.envar.value', 'curvalue') " /> |
In the example above, the markup element HTML INPUT is used. The pointer in the SAPI:VALUE attribute (see also Data Pointer) indicates that while generating the interface in the administrative area the value of the VALUE attribute of the INPUT element will contain the data that correspond to the query. Though the form naming system is out of the scope of the SAPI specification, it should be considered that when transmitting the CMS form data, the data must be identified and saved.
3.3.2 Static Data Containers
Static data containers (see also Static Data Container) refer to the recurring static data fragments of the document displayed on the website. These containers contain the presentation code of the fragments they refer to.
3.3.3 Dynamic Data Containers
Dynamic data containers (see Dynamic Data Container) refer to the fragments of the document displayed on the website. The content of these containers is based on a functional algorithm. These containers contain the description of functional algorithms.
SAPI implies the classification of dynamic data containers by categories determined by specific functionality. The category of the container communicates the processing peculiarities for the container to the CMS parser. The category of the container is specified in the CATEGORY attribute of the SAPI:DDC element; it classifies the functional solution during exchange in the “SAPI Works Gallery” (http://xmlsapiens.org/lib/).
|
Category |
Description |
Processing Peculiarities |
|
Information Channel | ||
|
infochannel.news |
News lines |
Interface in the administrative area |
|
infochannel.articles |
Article lines |
Interface in the administrative area |
|
infochannel.custom |
Custom lines |
Interface in the administrative area |
|
infochannel.periodical |
Periodical lines |
Interface in the administrative area |
|
Navigation | ||
|
navigation.calendar |
«Calendar» navigation form for information channels |
- |
|
navigation.menu |
Document structure navigation |
- |
|
navigation.track |
Path navigation to the current page |
- |
|
navigation.custom |
Other navigation |
- |
|
Forms | ||
|
form.custom |
Any dynamic forms |
- |
|
Other | ||
|
custom |
Other solutions that do not come under any of the categories mentioned above. |
- |
A SAPI object can be called through the SAPI:APPLY pointer, or directly in the condition expression. Objects identifiers have the following syntax:
|
object_name.object_attribute |
SAPI objects have the following attributes:
|
Category |
Description |
|
value |
Value returned by the object |
|
name |
Name of the object |
|
type |
Type of the object (query container, dynamic data container, static data container, CMS environment variable) |
|
value.length |
Length of the value string returned by the object |
|
value.date[format_string] |
Transformation of the UNIXSTAMP date into a given format |
Syntax of the Format String for value.date
|
Character |
Description |
|
a |
"am" or "pm" |
|
A |
"AM" or "PM" |
|
B |
Swatch Internet time |
|
d |
Day (date) of the month, 2 digits with leading zero, if needed; i.e. from "01" to "31" |
|
D |
Day of the week, alphabetical, 3 characters; e.g. "Fri" |
|
F |
Month, alphabetical, e.g. "January" (according to the regional settings) |
|
g |
Hour, 12-hours format without leading zeros; i.e. from "1" to "12" |
|
G |
Hour, 24- hours format without leading zeros; i.e. from "0" to "23" |
|
h |
Hour, 12- hours format; i.e. from "01" to "12" |
|
H |
Hour, 24- hours format; i.e. from "00" to "23" |
|
i |
Minutes, i.e. from "00" to "59" |
|
I (uppercase i) |
"1", if Daylight Savings Time, otherwise "0". |
|
j |
Day (date) of the month without leading zeros; i.e. from "1" to "31" |
|
l (lowercase 'L') |
Day of the week, alphabetical, long; e.g. "Friday" |
|
L |
Indicates if the year is a leap year: "0" or "1" |
|
m |
Month; i.e. from "01" to "12" |
|
M |
Month, alphabetical, 3 characters; e.g. "Jan" |
|
n |
Month without leading zeros; i.e. from "1" to "12" |
|
O |
GMT time difference, in hours; i.e. "+0200" |
|
s |
Seconds; i.e. from "00" to "59" |
|
S |
English ordinal suffix for days (dates) of the month, 2 characters; i.e. "st", "nd", "rd" or "th" |
|
t |
Number of days in the month; i.e. from "28" to "31" |
|
T |
Time zone settings on the computer; i.e. "EST" or "MDT" |
|
U |
Unix Epoch seconds (starting with January 1 1970 00:00:00 GMT) |
|
w |
Day of the week, digital, i.e. from "0" (Sunday) to "6" (Saturday) |
|
Y |
Year, 4 digits; i.e. "1999" |
|
y |
Year, 2 digits; i.e. "99" |
|
z |
Day of the year; i.e. from "0" to "365" |
|
Z |
Time zone shift, in seconds (i.e. from "-43200" to "43200"). Time zone shift to the west of the UTC is always negative, and to the east of the UTC is always positive. |
Sample output of static data container content, where the name of the container is var1:
|
<sapi:apply name="var1.value" /> |
Sample content output of a node of the CMS applications nodes set (see section 3.8.5.1) in the body of a dynamic data container (name of the container implies “this”, name of the set implies “this”, name of the set variable is “envar”):
|
<sapi:apply name="this.this.envar.value" /> |
Sample expression of a dynamic data container condition in the body of the container (name of the container implies “this”, name of the set implies “this”, name of the set variable is envar):
|
<sapi:apply exp="eq('this.this.envar.value', 'curvalue') " /> |
Sample content output of a CMS environment variable, where the name of the variable is var1:
|
<sapi:apply name="var1.value" /> |
A node of the set (see section 3.8.5.1) returned by a CMS application has the following properties:
|
Command |
Description |
|
position |
Returns the position of the current node within the nodes set (starting with 1). |
|
count |
Returns the number of nodes within the nodes set. |
|
length |
Returns the number of nodes within the nodes set. |
The number of nodes in the CMS application nodes set can be found out in the following way:
|
<sapi:apply name="this.this.length" /> |