1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
This is a base page template. All the other template pages implement this interface.
{% interface
Page {
Title()
Body()
}
%}
Page prints a page implementing Page interface.
{% func PageTemplate(p Page) %}
<html>
<head>
<title>{%= p.Title() %}</title>
</head>
<body>
<div>
<a href="/">return to main page</a>
</div>
{%= p.Body() %}
</body>
</html>
{% endfunc %}
Base page implementation. Other pages may inherit from it if they need
overriding only certain Page methods
{% code type BasePage struct {} %}
{% func (p *BasePage) Title() %}This is a base title{% endfunc %}
{% func (p *BasePage) Body() %}This is a base body{% endfunc %}
|