3.6.3.1 SAPI-Transformations during Site Viewing
At the initial stage of the process, according to the URL typed in the address bar or bound to a link, CMS environment variables (see Recommended CMS Environment Variables) are determined. Variable this.template contains the pointer to the representation template for the current document. The parser uses this pointer to access the representation template and check for the presence of SAPI objects pointers (SAPI:APPLY, section 6.4). To ensure full compliance with the SAPI specification, the presence of <?SYSTEM ?> constructs should be analyzed, since their content is transmitted to the system language for further execution. Using the pointers in the representation template, the parser calls the SAPI document for objects content (see Objects of SAPI Documents). The SAPI document can be converted into a database table: in this case the reference to the object description can be represented as a SQL query. The parser generates a copy of the template, which is a document prototype. During SAPI processing, the parser replaces the pointers of the objects with the obtained content.
3.6.3.1.1 Analysis of Data Pointers
When the parser refers to a SAPI document through a data pointer, it returns to the document prototype a value of the CMS environment variable with the name specified in the SELECT attribute of the SAPI:APPLY element.
3.6.3.1.2 Analysis of Query Containers
When the parser refers to a SAPI document through a pointer to a query container, it generates a query to the CMS data repository. Its parameters are the current values of the environment variables that identify the document or its part in the data repository and the name of the query container. The parser receives the content for the current query from the data repository and returns it to the document prototype. Let’s consider a query container pointer:
The content will be transferred to the document prototype. It will correspond to the CMS data repository container newsbody (news content) of the document with identifier “this.id”.
Example:
3.6.3.1.3 Analysis of Static Data Containers
When the parser refers to a SAPI document through a pointer to a static data container (see Static Data Container (Element SAPI:SDC)), it returns the content of this container to the document prototype. Pointers to SAPI objects and <?SYSTEM ?> constructs found in the container must be processed by the same pattern.
3.6.3.1.4 Analysis of Dynamic Data Containers
When the parser refers to a SAPI document through a pointer to a dynamic data container (see Dynamic Data Container (SAPI:DDC)), it analyzes the content of the container. First of all, the conditions of the root element SAPI:CHOOSE are analyzed. The condition expressions SAPI:EXP are parsed in the syntax specified in part 3.4. The content of the conditions, the expressions of which are TRUE, are added to the returned value thread. If the condition contains the SAPI:FOR-EACH construct, the application specified in the SELECT attribute is called. A similar condition analysis will be carried out as many times as there are values in the returned nodes set (see section 3.6.5.1). As soon as all instructions of the dynamic data container are implemented, the parser returns to the document prototype the returned value thread. Pointers to SAPI objects and <?SYSTEM ?> constructs found in the container must be processed by the same pattern.
3.6.3.1.5 Analysis of Additional Elements
When the parser finds the SAPI:SQL element with the TYPE attribute equal to «fetch-array», it executes the SQL query specified in the QUERY attribute. The result of the query is put into the CMS environment variable with the name specified in the NAME attribute. Pointers to SAPI objects and <?SYSTEM ?> constructs found in the container must be processed by the same pattern.
3.6.3.1.6 Analysis of System Language Inclusions
When the parser finds <?SYSTEM ?> constructs, it sends their content to the CMS system language for execution. The result of implemented instructions is returned into the document prototype.
3.6.3.2 SAPI-Transformation during Site Administration
Administration area is the interface for document content management. A document may contain an unlimited number of query containers, which will be represented in the interface by corresponding forms. Types of the forms are defined in the query container.
In the administration area the parser operates the same way as in the representation area, except that the query containers are processed differently. When the parser finds a query container pointer, it displays the code of its content. At that, the content of the query, if provided, is transmitted from the data repository and inserted into the query code. It is implied that a form is specified (e.g. <input>) in the query container body. Form attribute SAPI:attribute indicates to the parser where (in which attribute of the form element) to insert the query content when generating the administrative interface.
Example:
<input class="special" name="post_data[qvar1]" sapi:value="this.value" /> </sapi:qc> |