Jul 10th 2014
Coding 101 25
Perl: Creating Dynamic Web Pages
Create dynamic webpages with Perl.
The Code for today's show is available at our: Github
Ivory Tower
Dynamic Web Pages
- When we think of the most basic of web pages, we think of a static .html file. Example:
Hello World!
This web page is simple, easy to create, and easy to upload... but because it's static, it's also not all that useful unless you WANT to display nothing but static text, graphics and rich media
What we want is a way to DYNAMICALLY GENERATE the code of a web page so that we can do things like:
- Change the layout and template of the page without having to manually re-write the code
- Change the content contained within the page automatically
- Customize the content presented by a particular device depending on the device being used to view the content and the user consuming the content.
- In other words... the world of the Internet we use most often today is Dynamically Generated.
There are two methods to dynamically generate content: "Server Side" and "Client Side"
Client Side Dynamic Web Page:
- The browser processes the page using scripting AS it loads the HTML or XHTML document
- Usually, client-side scripts can be seen if one uses the "View Code" option on most browsers (The script is embedded within the HTML or XHTML document)
- Occasionally a web designer will put the script into a seperate file that is referenced by the HTML file (The browser will interpret the page and see the reference, at which time the server will send the file with the script.)
Popular Client-Side Scripting Languages:
- JavaScript (including Ajax)
- ActionScript (most often used with Adobe Flash Player)
- Dart
- VBScript
- Typescript
Server Side Dynamic Web Page:
- As one may guess, unlike a Client-Side Dynamically Generated Web Page, which is intepreted by the browser as it loads the document, a "Server-Side" page is interpreted and generated by the SERVER, and the finished document is sent to the browser.
Popular Server-Side Scripting Languages:
- PHP
- ASP .NET
- Perl
- Python
- Ruby
- Java
- ColdFusion
- JavaScript (Server Side)
Usually, Server Side scripts CANNOT be seen by simply viewing a document's code.
There are advantages and disadvantages to both techniques.
- Client-Side gets a bad rap for insecurity, but it's not INHERENTLY insecure... usually it's just sloppy scripting code... BUT while many will allow server-side scripts to run beyond the browser, that is usually not the case with client-side scripting.
- Server-Side scripting gives a more consistent look because the page is being interpreted by the server, rather than each individual (and often different) browser
- Client-Side scripting is usually MUCH easier to start using since there is no software that need to be installed on the server to make them run. (The script is interpreted in the browser)
- Client-Side is dependent on the client machine: A bad browser or slow computer will affect the ability to render the page.
- In modern design, we use both!
Get in Touch With Us!
- Subscribe and get Coding 101 automatically at https://twit.tv/shows/coding-101
- Follow PadreSJ and Snubs on Twitter
Bandwidth for Coding 101 is provided by CacheFly.