example: overlay chain negative space
Let's modify the positive chain example a little to show a negative overlay.
We add the overlay_chain_neg.html template that is a negative
overlay on the unmodified overlay_mid.html + base.html
base templates (from previous example). This example also shows how to specify
specific levels in the overlay chain at which to start lookup.
overlay_chain_neg.html
$overlay{overlay_mid.html, space="negative"}
<html>
<head><title>template = ${title}</title></head>
<body> <span> -ve space (overlay_chain_neg.html) </span>
$begin{content} overlay_chain_neg ${parametrized} content $end{content}
$begin{footer}<span>overlay_chain_neg footer</span>$end{footer}
<div class="header">$evoque{#header}</div>
<div class="content">$evoque{#content}</div>
<div class="refootered">
<div class="own">$evoque{#footer}</div>
<div class="overlaid">$evoque{##footer}</div>
<div class="named">$evoque{base.html#footer}</div>
</div>
</body>
</html>
- a negative overlay, thus using own negative space
- redefines #content and #footer
- evoques all 3 #footer templates in the overlay chain, showing how to:
- start lookup from self
- start lookup from "one level below"
- explicitly evoque a named template
Output
Rendering the overlay:
name = "overlay_chain_neg.html"
domain.get_template(name).evoque(title=name, parametrized="HAPPY")
Will give the following output:
<html>
<head><title>template = overlay_chain_neg.html</title></head>
<body> <span> -ve space (overlay_chain_neg.html) </span>
<div class="header">+ve space: base header </div>
<div class="content">overlay_chain_neg HAPPY content </div>
<div class="refootered">
<div class="own"><span>overlay_chain_neg footer</span></div>
<div class="overlaid"><span>overlay_mid footer</span></div>
<div class="named">+ve space: base footer </div>
</div>
</body>
</html>