INCLUDE
The INCLUDE tag is a very useful tag to keep the HTML files unclustered and to guarantee the same appearance of all pages.
General information about the basic structure of all HTML files, such as background color and background image in the BODY tag, as well as the structure of titles and footers can be defined in special small files.They can then be included into all pages via the INCLUDE tag instead of being repeated in every single file. Many of the actions to be executed through Chilli scripts are very similar in quite a number of pages. Therefore, they also can be put into separate files, which will then be included in many other files through the INCLUDE tag.
This considerably reduces the work required to set up the pages as well as the file sizes. It furthermore facilitates the task of making changes to the basic appearance of the HTML files should the need occur. The INCLUDE tag will be replaced in its entirety by the contents of the included file.
Start Tag | required |
End Tag | forbidden |
Syntax | <INCLUDE htmlfile='file name' [condition='condition value'] [onceonly]> |
Mandatory Parameters
The htmlfile parameter defines the name and path of the file with which to replace the INCLUDE tag. The file path is relative to the path of the current file into which the new file is to be included. |
Optional Additional Parameters
A value which is evaluated as an expression and determines if the file include is to be executed or not. | |
The onceonly parameter is used to avoid the multiple loading of the same data, which causes an error and stops the execution of a script. |
htmlfile
The file parameter defines the name and path of the file with which to replace the INCLUDE tag. The file path is relative to the path of the current file into which the new file is to be included. If, for example, the current file is located in a directory webconsole/commonviews/user , and the file containing all body information, located under directory webconsole/lib is to be included, the file information would read like this: file='../../lib/Body.html' .
Example
The included file in the following example is a file called Body.html which gets the background image file. If this is set to NONE it gets the wall paper color.
Source File
Output File
onceonly
The onceonly parameter is used to avoid the multiple loading of the same data, which can cause an error and stop the execution of a script. This is used to make sure a file is only loaded once, because files can be called several times through the INCLUDE tag of included files, for example.
Example
The index file calls the following files containing the components required to create the base page:
<INCLUDE htmlfile="../common/scripts/header.hchl" onceonly>
<INCLUDE htmlfile="../common/scripts/footer.hchl" onceonly>
Due to the onceonly parameter, the scripts contained in these files are only executed once, as required for the creation of the pages.
condition
The condition parameter is a value which is always evaluated as an expression, whether it is included in parentheses () or not. If the value is true, the included file is executed. If the value is false, nothing happens and the included file will be
ignored. The default value is "true" (if the condition parameter is not specifically mentioned).