When parsing documents and templates, eSite performs 3 possible kinds of code transformations on the documents before parsing any instructions in the documents.
Wrapping the document
If an eSite document does not begin with <?esite
and end with ?>
statements, these statements are added to the document., along with a statement tying the document to the default template using a PHP require
statement. If the document author wishes to use a template other than the default for a particular document, he may write the complete code to use the template himself.
Bracketed Statements
eSite provides a set of statements in the form [ESITE SOME STATEMENT]
that are transformed into PHP code inside <?esite ?>
tags during the second transformation. The purpose of these statements is to cover code that is required for parsing, but which does not contribute to any logic of the template or document. The allowed bracketed statements are outlined below:
- [ESITE BEGIN]
- eSite has a concept of "document content" which is embedded within a template during parsing. This statement marks the beginning of thd document content. "Document content" may include eSite code, but does not need to. The concept allows a template to be designed that drops the content of the document into a single location within the template. This statement is replaced with the following code on a line by itself:
$esite_document_content = <<<END_OF_CONTENT
- [ESITE END]
- This statement marks the end of the document content started with
[ESITE BEGIN]
discussed above. It is replaced with the following code on a line by itself:END_OF_CONTENT;
- [ESITE PARSE DOCUMENT CONTENT]
- This statement is replaced with code to include the content of the document enclosed between
[ESITE BEGIN]
and[ESITE END]
bracketed statements; it is only meaningful in a template. It is replaced with the following code:
<?esite esite_parse_document_content($esite_document_content); ?>
- [−−ESITE SOME STATEMENT]
- eSite strips out the double -- signs following the bracket, allowing the bracket statement to be carried forward into the completed document. So far it only seems useful when writing documentation for eSite.
tags
Code to be parsed by eSite is, once the above transformations have been completed, enclosed in <?esite ?>
tags. PHP calmly ignores all code not in <?php ?>
tags, so the following transformations are done: <?php
is changed to <?esite-php
and <?esite
is changed to <?php
. Once the parsing is completed, this step is undone, leaving a valid PHP document, if the original documents or templates contained any code wrapped in <?php ?>
tags.