This is an old revision of the document!
Every template is an instance of the <php>Template</php> class defined in include/utils.php
.
Rack templates support basic template inheritance, provided by the following functions:
Note that nested blocks are not supported and that blocks are only allowed in templates that extend a parent template.
Templates are intitialized with a context object, which is an associative array. The individual elements of this array are made available in the templates as regular variables (see extract). Consider the context
<PHP> $context = [
'title' => 'Home', 'page_id' => 'index'
]; </PHP>
and the template
<PHP> <html>
<head> <title><?= $title ?></title> </head> <body> <h1><?= $title ?></h1> page_id: <?= $page_id ?> </body>
</html> </PHP>
which renders as
<HTML>
<h1>Home</h1> page_id: index
</HTML>