April 23, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Combine JavaScript and a Template Engine for Flexible Web Apps

  • February 9, 2010
  • By Alessandro Lacava
  • Send Email »
  • More Articles »

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


Tags: JavaScript, Ajax, templates, Trimpath, Template engine




Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel