Wednesday, 21 November 2012

Dynamic vs. Static Web pages


The "Hello, World" example we chose would certainly not require you to use PHP. That's because it is static,meaning its display will always remain the same. But what if you wanted to greet the world in any number of ways? Say, for example, "Bonjour, World!", or "Yo, World!" and so on.

Since HTML tags are purely descriptive they cannot function as a variable. Nor can they convey even the
simplest of uncertainty such as a "Bonjour" or a "Yo". You need a command language to handle variability in a web page. Based on either a conditional statement or direct user input, a command language can generate the "static" HTML necessary to correctly display a Web page's content.

Let us reconsider example #3. This time we want to let the user decide how to greet the world:
Example 4: PHP embedded within HTML revisited!
<?php print $greeting, ", "; ?> World!

From the above example, $greeting is assigned a value, and together with the comma and the word "World!", this value is sent to the browser. Dynamic Web page design, however, is more than just about inserting variables. What if you wanted not only to greet the world in French, but also to present the page using the colors of the French flag? Both a Web page's structure as well as its content can be customized. This means dynamic Web page programming can also entail on-demand Web page building.    No static, here!

No comments:

Post a Comment