Combine JavaScript and a Template Engine for Flexible Web Apps

Tuesday Feb 9th 2010 by Alessandro Lacava
Share:

Combine the power and simplicity of the TrimPath template engine with JavaScript and Ajax to develop next-generation web applications.

Template engines (TEs) can be very useful in web development scenarios where you need to generate and format text automatically according to specific processing rules. Basically, a TE takes a data model, applies a given template, and produces the result document. These engines can also help you build your applications based on the Model-View-Controller (MVC) pattern, making them more robust and maintainable than applications based on spaghetti code. Most programming languages provide built-in or third-party TEs.

Merging a TE and JavaScript will enable you to build very flexible web applications. Using them together also helps keep the presentation logic separated from the model. So, for example, you could use several templates—which you might load using Ajax—to present the same data through different layouts.

In his Web Developer's Virtual Library (WDVL) article, Alessandro Lacava shows you how to combine the power of a TE called TrimPath with one of the most used client-side programming languages, JavaScript. In the past, JavaScript was used just for form validation and other "trivial" tasks. However, since the emergence of Ajax, JavaScript has gained more and more popularity among web developers. The capability to make asynchronous calls to the server and update a web page without reloading it made JavaScript a language that no web developer could do without.


Read the full story at Web Developer's Virtual Library:
Combine JavaScript and a Template Engine for Flexible Web Apps

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved