+ All Categories
Home > Documents > CS 3314 Advanced Web Programming for E- Commerce

CS 3314 Advanced Web Programming for E- Commerce

Date post: 22-Dec-2015
Category:
View: 217 times
Download: 0 times
Share this document with a friend
35
CS 3314 Advanced Web Programming for E-Commerce http://www.cs.ucc.ie/j.bowen/ cs3314/
Transcript

CS 3314

Advanced Web Programming for E-Commerce

http://www.cs.ucc.ie/j.bowen/cs3314/

Servers and Browsers

• Servers make web documents, which are specified in HTML, available on request to browsers

• Browsers display, to users, web documents which have been received from servers

Servers and Browsers

Web Programming

• Programming for the World Wide Web involves both– server-side programming, and– client-side (browser-side) programming

Client-side programming

• In this module, we will consider the following mechanisms for client-side programming:– HTML 4.0– Cascading Style Sheets– Javascript

Server-side Programming

• In this module, we will consider – the Hyper Text Transfer Protocol (HTTP)– server-side programming in PHP

Other topics

• We will also consider– user-interface design– security

Assessment

• Of the marks available for the module,– 80% are available from the end-of-year written

examination– 20% are available from continuous assessment,

a series of in-class tests that will be administered from time to time

HTML: HyperText Markup Language

Assumption

• Some of you know a little HTML, but others do not know the language at all

• Beware that good HTML programming methodology is still evolving

• The most modern version of HTML is XHTML, which is very close to HTML 4

• We will adhere rigidly to HTML 4.0, even though browsers tend to be more tolerant

• XHTML will be introduced later

• HTML is the language used for specifying WWW documents

• A specification, in HTML, of a WWW document contains raw content (text) along with items called tags which are used to tell browsers about the content and to refer to non-text content

HTML Specification of a Simple Document

<html> <head> <title> Hello Document </title> </head> <body> Hello there </body> </html>

Viewing this document using Netscape

• The HTML fragment <title> Hello Document </title> tells the browser what title to place on the top line

of the browser display

• The HTML fragment <body> Hello there </body> tells the browser what to put in its content display region

Viewing the document using Explorer

Browsers treat documents slightly differently

• See how the document titles are placed differently on the top line of the browser

• See how the content display regions have different colours

Testing your web-site

• When you make you web-site live, it may be accessed by anybody on the WWW

• You have no idea which browser they will be using

• But it is a good idea to test you site on the most likely browsers

The items below are called tags

<html> <head> <title> </title> </head> <body> </body> </html>

Notice that tags come in pairs:

A tag pair contains something:

• The tag pair <html> … </html> contains a HTML specification of a document, including always– “header” information, that is info about the

document– the content of the document

• The tag pair <head> … </head> contains the header information about the document, including– the title of the document (always present)– other information (optional)

• the tag pair <title> … </title> contains the title of the document

• The tag pair <body> … </body> contains the content of the document

Thus, the simplest HTML specification is of the form:

<html>

<head>

<title> Some-title </title>

</head>

<body> Some-content </body>

</html>

Example document spec:

<html>

<head>

<title> A silly document </title>

</head>

<body> Isn’t this easy???? </body>

</html>

Another example specification:

<html>

<head>

<title> Silly document #2 </title>

</head>

<body> Well, well!! </body>

</html>

Dividing text into paragraphs:

Dividing text into paragraphs<html>

<head> <title> The Ironies of History </title> </head>

<body>

<p>In August 1914, a bullet was fired in Sarajevo which led,

indirectly, to the deaths of thousands of Congolese in 1999.

The bullet in Sarajevo caused World War I which, in turn, caused

the Russian Revolution. </p>

<p>The Russian Revolution led, eventually, to the Cold War. The Cold

War caused The West to support Mobutu in his kleptocratic rule of

the Congo, leading to such a breakdown of society that the Congo

has experienced a series of civil wars in the late 1990s. </p>

</body>

</html>

The Paragraph tags:

• The tag <p> is used to start a paragraph while the tag </p> is used to end a paragraph

• Ensure you use the </p> tag at the end of a paragraph:– some browsers do not insist on it but other programs

rely on its presence

• NEVER use a <p> tag or a </p> tag to get “white space”


Recommended