Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Original HTML generator
- var HTMLCode = '<h1>' + pageTitle + '</h1><div id="content"><p>' + pageContent + '</p><div id="author_bio"><p>' + authorBio +'</p></div></div><div id="footer"><p>' + footerContent + '</p></div>';
- # Better improvement with line breaks and format
- var HTMLCode = '\n' +
- '<h1>' + pageTitle + '</h1>\n'
- '<div id="content">\n' +
- '<p>' + pageContent + '</p>\n' +
- '<div id="author_bio">\n' +
- '<p>' + authorBio + '</p>\n' +
- '</div>\n' '</div>\n' +
- '<div id="footer">' +
- '<p>' + footerContent + '</p>\n' +
- '</div>\n';
- # JS HTML Template
- <script type="text/plain" id="entry-template">
- <h1><%- pageTitle %></h1>
- <div id="content">
- ...
- </div>
- </script>
- var EntriesView = Backbone.View.extend({
- template: _.template($("#entry-template").html()),
- render: function() {
- return self.template(data);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement