Introduction to Web Dynamic Content:

ugliestharrasΛογισμικό & κατασκευή λογ/κού

4 Νοε 2013 (πριν από 3 χρόνια και 5 μήνες)

74 εμφανίσεις




1




Introduction to Web Dynamic Content:




Designing For
Dynamic

Content WEB
1005M



With the growth of the Web, there has been a similar growth in the in the
services that are accessible over the Web. Many new services are web sites
that are driven from
data stored in databases. Well known web destinations
such as online stores, auction sites, discussion forums and personalised
homepages are examples of dynamic web data base applications. The
popularity of these applications stems from their accessibilit
y and usability;
thousands of users can access the same data at the same time without the
need to install additional software on their machines



Static Vs Dynamic


In the beginning of the Internet, almost all content was entirely made of static
HTML and t
ext documents. Many first generation web sites and even some
new web sites launched today are composed of static, non
-
changing content.
Very quickly, these web sites become old and outdated and are not much help
to the consumer. A static web site usually c
ontains minimal information and
some contact information. On the other hand, a dynamic web site contains
pages that can be changed by any program, script or administrator at any
time. A dynamic web site usually contains functionality that cannot be found
o
n a static web site.




Typical Dynamic Web Site


A shopping cart website is a typical example of dynamic content. The user
can view products, product information, price, stock level and availability. If
the user then decides to buy products or items (add
to the shopping cart etc),
several pieces of information immediately change in the users browser.
Typical content change is:




Items purchased



Cost for each item



Total cost



Balance of account


The user can continue to add more items and can view the updat
ed
information. If the user then decides to change the items in the shopping cart
the information changes. At the end of the process, the user may decide to
buy. A login and password is normally required which verifies and identifies
the user.




2


Next, the

user is provided with specific information relating to their account.
After purchasing the products in the shopping cart the user may be presented
with an invoice via email, showing the order placed and the amount payable
or directly debit an account. The

information relating to products and stocks
etc is constantly being updated.


This is a typical example of a website which includes DYNAMIC CONTENT
and is DATABASE DRIVEN. In other words, the content in website is
dynamically updated by information stored

in a database. The information in
the database is also updated dependant on the user input and request.



Question:

What is a dynamic website?



Answer:

Dynamic refers to a type of site where each page is created by
the server dynamically, every time it

is requested by the
browser. In other words, the pages that you see are only
templates, and the actual content is stored elsewhere, usually in
a database.




Question:

What advantages do dynamic websites provide?


Answer:

Reduce maintenance and administra
tion

Help distribute the workload

Increase the responsiveness of the web site

Large volumes of content can be up very quickly




Dynamic Content Components


There are many technologies available for creating a dynamic website, and
they can be combined in e
ven more ways to form a programming platform.
There are several technologies for scripting which include:




JSP (
JAVA Server Pages)



PHP (PHP Hypertext Pre
-
processor)



ASP (
Active Server Pages)



Perl (O
ne of the first scripting languages used for CGI programm
ing)



Coldfusion (
Macromedia technology, which allows a scripting language
directly within an html document on the server.



There are also different technologies for storing data, which include:




PostgreSQL



MySQL



Oracle



IBM's DB2



Microsoft's SQL Server




3


Fo
r this module we will be using PHP as the scripting language and MySQL
for the database.






4

PHP (Scripting Language)


PHP is a popular choice for the following reasons:




Open source (entirely free)



Community efforts to maintain and improve it are unconstra
ined by
commercial influence.



One or more PHP scripts can be embedded into static HTML files



Fast execution of scripts



Platform and operating system flexibility



Fully featured programming language suited to complex systems
development


MySQL (Database)


MySQL is Database Management System (DBMS) and is a popular choice for
the following reasons:




Open source (entirely free)



Fast execution



Low resource overheads



We will use PHP scripting language with its extensive function libraries that
interact with m
any database systems and the web environment. This develops
the applications logic that brings together the Web and the relational database
management system (RDBMS) to create dynamic Websites.



PHP & MySQL How it Works.




A typical PHP page will contain
a number of PHP elements along with
HTML mark up elements and other textural content.




When a Web browser requests a PHP page from a Web Server that is
PHP

enabled, the server will call up the PHP parser to process all the
elements on that page.




The PHP p
arser executes the PHP script instructions on the page,
generating a HTML document that is sent to the Web browser as a
response to the original request.




The PHP parser may also be asked to retrieve and update information
from the database




Code that i
s executed on the server such as PHP is called ‘server side’ code.
The HTML page containing the PHP script must be on the server to function
correctly. In order to provide Dynamic Web Sites using PHP and MySQL the
Internet Service Provider Web Space must b
e
PHP and MySQL enabled.






5

Figure 1 shows the systems components required for delivering dynamic web
content using PHP and MySQL.




























Dynamic Web Site Examples


Web pages that contain PHP script can normally be identified in the
browser
address by the .php extension.



Student Exercise


1.

Browse the Web and identify
gallery web
sites you think are using PHP
and databases to provide dynamic content.


2.

Try to find
3

examples of
gallery
dynamic content
w
eb sites. Make a list
so we can h
ave some discussion.


3.

Look for Web sites that will help you to learn PHP and MySQL


4.

Have a look at the source code
in the browser
for PHP Web Sites. You
will find some thing very interesting.

What have you observed?

Client


Web Browser

Database

Server

PHP parser

<html>

<body>


<?php


PHP Script


?>


</body>

</html>



<html>

<body>


Dynamic PHP
content


</body>

</html>


Request

Response

Figure 1
Dynamic Content
Component