taking advantage of client side / javsscript templates in rich internet applications
DESCRIPTION
TRANSCRIPT
![Page 1: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/1.jpg)
Chief Technology OfficerBlueliner NY www.bluelinerny.comwww.mahbubblog.com
Md. Mahbubur Rahman
![Page 2: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/2.jpg)
?What is Rich Internet Applications, Btw
![Page 3: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/3.jpg)
Rich Internet Applications
![Page 4: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/4.jpg)
Templates Again ?
![Page 5: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/5.jpg)
Why JavaScript Templates ?JavaScript templates are rendered and cached client-side without sending an HTTP request to the server — in other words, they’re lightning fast. Speed benefits aside, JavaScript templates also afford us the opportunity to abstract the administrative UI into a simple JavaScript API.
Rich and Faster User Experience
Decrease the load on Server [ increase scalability ]
Easy to Manage
And.. Because the modern web browsers are very powerful
![Page 6: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/6.jpg)
Pushing Some loads to Client’s Computer
![Page 7: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/7.jpg)
Flow of how JavaScript Templates work
![Page 8: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/8.jpg)
HOW DO JAVASCRIPT TEMPLATES LOOK LIKE
HTML
JSON
<div class="entry"> <h1>{{title}}</h1>
{{#with author}} <h2>By {{firstName}} {{lastName}}</h2> {{/with}}</div>
{ title: "My first post!", author: { firstName: "Charles", lastName: "Jolley" }}
![Page 9: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/9.jpg)
HOW DO JAVASCRIPT TEMPLATES LOOK LIKE - 2
<script id="movieTemplate" type="text/x-jquery-tmpl"><tr>
<td>{{=Title}}</td><td>
{{#if Languages}}Alternative languages: <em>{{=Languages}}</em>.
{{else Subtitles}}Original language only... <br/>Subtitles in
<em>{{=Subtitles}}</em>.{{else}}
Original version only, without subtitles.{{/if}}
</td></tr>
</script>
![Page 10: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/10.jpg)
HOW DO JAVASCRIPT TEMPLATES LOOK LIKE - 3
<script type="text/javascript">var movies = [{ Title: "Meet Joe Black", Languages: "English and French", Subtitles: "English"}, { Title: "Eyes Wide Shut", Subtitles: "French and Spanish"}, { Title: "The Mighty"}, { Title: "City Hunter", Languages: "Mandarin and Chinese"}];$("#movieList").html($("#movieTemplate").render(movies));
</script>
![Page 11: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/11.jpg)
HOW DO JAVASCRIPT TEMPLATES LOOK LIKE – 4
![Page 12: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/12.jpg)
Ways of Using Visitor’s PCs.
Adobe Flash / Flex
Google Gears
Microsoft Silverlight
HTML5
![Page 13: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/13.jpg)
Let some computation be done by Client
![Page 14: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/14.jpg)
Right AJAX Data Transport
XML
JSON
HTML
![Page 15: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/15.jpg)
Same Template for Server side and Client Side
Ex. Mustache, Handlebar JS
Available in Ruby, JavaScript, Python, Erlang,
PHP, Perl, Objective-C, Java, .NET, Android, C++,
Go, Lua, ooc, ActionScript, ColdFusion,
Scala, Clojure, Fantom, CoffeeScript, D, and for node.js.
![Page 16: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/16.jpg)
Same Template for Server side and Client Side (Contd.)
![Page 17: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/17.jpg)
JS Templating Good when
Loading all data from the server especially in rich list displays
Adding or updating new items in lists
Anywhere you need to add new complex content to the page
Anything that requires client side HTML rendering
![Page 18: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/18.jpg)
JavaScript Templating best suited for
Stock Related appsWeb Admin PanelLive ScoreWeb DesktopsAny AJAX Intensive app
![Page 19: Taking Advantage of Client Side / JavsScript Templates in Rich Internet Applications](https://reader035.vdocument.in/reader035/viewer/2022070304/54c68cc14a795997468b45bb/html5/thumbnails/19.jpg)
Some JavaScript Templating Engines
jQuery.View (https://github.com/BorisMoore/jsviews)
jQuery View Renderer (https://github.com/BorisMoore/jsrender)
Mustache (http://mustache.github.com/)
EJS (http://embeddedjs.com/)
PURE (http://beebole.com/pure/)
HandlebarJS (http://www.handlebarsjs.com/)
UnderscoreJS (http://documentcloud.github.com/underscore/)