Skip to content
Go to file
Latest commit ee9848b Apr 22, 2012 History
1 contributor

Users who have contributed to this file

54 lines (43 sloc) 1.38 KB
<script id="headertmpl" type="text/x-dot-template">
<script id="pagetmpl" type="text/x-dot-template">
<h2>Here is the page using a header template</h2>
<script id="customizableheadertmpl" type="text/x-dot-template">
{{#def.mycustominjectionintoheader || ''}}
<script id="pagetmplwithcustomizableheader" type="text/x-dot-template">
<h2>Here is the page with customized header template</h2>
<div>{{=it.title}} is not {{}}</div>
<script src="../doT.min.js" type="text/javascript"></script>
<div id="content"></div>
<div id="contentcustom"></div>
<script type="text/javascript">
var def = {
header: document.getElementById('headertmpl').text,
customheader: document.getElementById('customizableheadertmpl').text
var data = {
title: "My title",
name: "My name"
var pagefn = doT.template(document.getElementById('pagetmpl').text, undefined, def);
document.getElementById('content').innerHTML = pagefn(data);
pagefn = doT.template(document.getElementById('pagetmplwithcustomizableheader').text, undefined, def);
document.getElementById('contentcustom').innerHTML = pagefn(data);
You can’t perform that action at this time.