Created
August 10, 2011 02:58
-
-
Save Lobstrosity/1135981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Templates</title> | |
</head> | |
<body> | |
<div class="greeting"></div> | |
<script class="greeting" type="text/x-jquery-tmpl"> | |
<p>Hello, ${firstName} ${lastName}</p> | |
</script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.min.js"></script> | |
<script> | |
var user = { | |
firstName: 'John', | |
lastName: 'Doe' | |
}; | |
$('div.greeting').html($('script.greeting').tmpl(user)); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Templates</title> | |
</head> | |
<body> | |
<div class="listing"></div> | |
<script class="listing" type="text/x-jquery-tmpl"> | |
<p>${firstName} ${lastName}</p> | |
<ul> | |
{{each phoneNumbers}} | |
<li>${$value}</li> | |
{{/each}} | |
</ul> | |
</script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.min.js"></script> | |
<script> | |
var user = { | |
firstName: 'John', | |
lastName: 'Doe', | |
phoneNumbers: [ | |
'555-1111', | |
'444-8888' | |
] | |
}; | |
$('div.listing').html($('script.listing').tmpl(user)); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Templates</title> | |
</head> | |
<body> | |
<div class="items"><ul /></div> | |
<script class="items" type="text/x-jquery-tmpl"> | |
<li>${$item.data}</li> | |
</script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.min.js"></script> | |
<script> | |
var items = [ | |
'Item 1', | |
'Item 2', | |
'Item 3' | |
]; | |
$('div.items ul').html($('script.items').tmpl(items)); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Templates</title> | |
</head> | |
<body> | |
<div class="listing"></div> | |
<script class="listing" type="text/x-jquery-tmpl"> | |
<p>${firstName} ${lastName}</p> | |
<ul> | |
{{tmpl(phoneNumbers) '.phoneNumbers'}} | |
</ul> | |
</script> | |
<script class="phoneNumbers" type="text/x-jquery-tmpl"> | |
<li>${$item.data}</li> | |
</script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script src="https://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.min.js"></script> | |
<script> | |
var user = { | |
firstName: 'John', | |
lastName: 'Doe', | |
phoneNumbers: [ | |
'555-1111', | |
'444-8888' | |
] | |
}; | |
$('div.listing').html($('script.listing').tmpl(user)); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment