Insert multiple toddler template files into main
2 answers
If you replace the genshi instead of the default boy, you can do it with the include tag:
<xi:include href="menu.html" />
Switching to genshi is pretty easy, I think it's a matter of convenience only. Template tags work differently. However, you must rename the extensions from .kid to .html.
+1
a source to share
First you can define the "base_layout.kid" template:
<html xmlns:py="http://purl.org/kid/ns#">
<head>
<title>App Name - ${page_title}</title>
<link href="layout.css" type="text/css" rel="stylesheet" />
${page_specific_css()}
</head>
<body>
<h1>Now viewing: ${page_title} of App Name</h1>
<content>Default content</content>
<div class="footer">Page Footer Text</div>
</body>
</html>
Then replace the "content" tag in "page.kid" with whatever data you want:
<html py:layout="'base_layout.kid'"
xmlns:py="http://purl.org/kid/ns#">
<link py:def="page_specific_css()"
href="layout.css" type="text/css" rel="stylesheet" />
<div py:match="item.tag == 'content'">
<ul>
<li>Content Item 1</li>
<li>Content Item 2</li>
<li>Content Item 3</li>
</ul>
</div>
</html>
You can check if you are using html correctly in python shell (after removing all used ids):
>>> import kid
>>> t = kid.Template("page.kid")
>>> print t.serialize()
+1
a source to share