The mapping for templates to URLs is straightforward. Following are a few
examples, where <templates> is a placeholder for one or more directories
that will be searched for a match:
http://localhost/eg/opac/home ⇒ /openils/var/<templates>/opac/home.tt2
http://localhost/eg/opac/advanced ⇒ /openils/var/<templates>/opac/advanced.tt2
http://localhost/eg/opac/results ⇒ /openils/var/<templates>/opac/results.tt2
The template files themselves can process, be wrapped by, or include other
template files. For example, the home.tt2 template currently involves a
number of other template files to generate a single HTML file:
Example Template Toolkit file: opac/home.tt2.
[% PROCESS "opac/parts/header.tt2";
WRAPPER "opac/parts/base.tt2";
INCLUDE "opac/parts/topnav.tt2";
ctx.page_title = l("Home") %]
<div id="search-wrapper">
[% INCLUDE "opac/parts/searchbar.tt2" %]
</div>
<div id="content-wrapper">
<div id="main-content-home">
<div class="common-full-pad"></div>
[% INCLUDE "opac/parts/homesearch.tt2" %]
<div class="common-full-pad"></div>
</div>
</div>
[% END %]
We will dissect this example in some more detail later, but the important thing to note is that the file references are relative to the top of the template directory.