PET has a built-in capability called “filtering”. Filters are modules which manipulate (preprocess) templates before they are actually processed (run). In the following examples we will be demonstrating how it looks like!
| Hello, World-2! | PET has a built-in capability called “filtering”. |
| Including a file | Using the filter called “general”, the following snippet includes a template. |
| Displaying a directory | The following script reads in a directory and displays its content. |
| Multilangue support | |
| More filters | There are more filters, and of course you can also create your own. |
The following script reads in a directory and displays its content. It is using the XML filter and the IO utility plugin.
<io:getDir=files dir="html/tmp" />
[% FOREACH file = files %]
[% file %]<br />
[% END %][% file = Util.io.getDir('dir' , 'html/tmp') %]... file1 file2 file3 ...
...
{{you_have}} [% subst.messagecount %] {{new_messages}}
...... you_have: You have ** new_messages: new message(s). ** ..
You have 5 new messages.
There are more filters, and of course you can also create your own. Read Filters for more information.