I'm trying to learn how to use Snap and Heist and wanted to put links to JavaScript libraries in on place. I created this template in _js-libs.tpl
:
<bind tag="jquery">
<script type="text/javascript" src="/js/jquery-2.1.0.js"></script>
</bind>
<bind tag="d3js">
<script type="text/javascript" src="/js/d3.js"></script>
</bind>
And then tried this in the base.tpl
template:
<html>
<head>
<title>Snap web server</title>
<link rel="stylesheet" type="text/css" href="/screen.css"/>
<apply template="_js-libs"/>
<jquery/>
<d3js/>
</head>
... snip ...
But this just resulted in <jquery></jquery>
and <d3js></d3js>
in the page. I take it bind tags are not visible in a template which has applied the template containing the bind. How do I create top level tags like this in templates? I can only find examples of creating top level tags in Haskell code.
The bind tag only works locally to a template. The only exception to this is if you use bind tags inside the body of an apply tag as a mechanism to pass named "parameters" to the applied template.