This page uses the default.html template and draws its main content from the content.html file.
Contemplate includes several extra features that come in handy when building complex templates. Here are some examples:
Take content from another file and remove its HTML tags before displaying it:
Take content from another file and remove its line breaks before displaying it:
This feature supports regular expressions. For example, we could also remove all vowels:
Embed values from page definitions
We can easily embed invidual values from page definitions into our content or templates. Here are the three elements used to build this page:
Embed type: field
File name: content.html
Field name: extras_1
This allows us to write scripts, for example, that are aware of the page details. This button runs a script that displays the current page name:
Embed environment variables
Contemplate can access the server's environment variables and display those in the same way as values from page definitions. For example, here's the server's software version: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16
A special environment variable contains the last modified date of the newest element making up an assembled page: 2011-09-26 10:42:41
Display conditional content
At the template or content level, conditional tags can help reduce duplicate code. The conditional expression can include any PHP code, or any of the values displayed above. For example, the following label tells us whether this page has one sidebar or two: two sidebars.