Pair program with me! profile for carousel at Stack Overflow, Q&A for professional and enthusiast programmers

5/13/2013

HTML metamorphosis

In the beginning, there was that pure markup language, which was fetched from the server, and rendered in the browser:
<h1>Hello from the HTML</h1>

Hello from the HTML


Then, someone sad that we should bring some formatting, so it looks nice:
<h1 style = "color:red">Hello from the HTML</h1>

Hello from the HTML


And also some Javascript, to make web-sites more dynamic:
<h1 style = "color:red" onclick=clickMe>Hello from the HTML</h1>

Hello from the HTML


But, that wass all inline.  So it was good idea to place our CSS and Javascript in a separate files:



And we had nicely formatted code that could responde to users activity. Sut something was missing - maybe some HTML dissecting on a server side.

No problem - here comes PHP:
<h1><?php  echo "Hello from the PHP, embedded in HTML on a server side?></h1>
Hey, we could reuse out HTML!!! Say hello to to templates:
<h1>{{title}}</h1>
<p>{{some paragraph text}}</p>

We can even render out HTML on a client side:
Backbone.View.extend({

render:function(){
    this.$el.html(...);
};


So HTML has been changing it't role on a web quite often, but at the same time remainig dominant  language for building web sites and applications.

Happy Coding.

No comments:

Post a Comment