Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

Templating and handlebars.js


There is one more Hello, world example to go! Throughout the book, we have been using PHP most of the time. We have used it to dynamically generate web pages, or portions thereof. So PHP code, often embedded inside HTML code in a file with .php as an extension, is executed on the server and what is rendered by the browser is pure HTML. You also learned how to generate HTML from a separate PHP file or even JavaScript on the client side, using data that comes from the server, and then inject it into a portion of a web page (Ajax).

Combining PHP and HTML and even a small chunk of client-side JavaScript inside a single file was made possible thanks to the <script> tag and by putting PHP code in between <?php and ?>. That is why they sometimes call PHP a templating language.

Now imagine an all-JavaScript ecosystem. Yes, we could still put our client JavaScript code in between <script> tags, but what about the server JavaScript code? There is no such...