+ All Categories
Home > Documents > And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords...

And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords...

Date post: 12-Jan-2016
Category:
Upload: lorraine-wood
View: 214 times
Download: 0 times
Share this document with a friend
30
and XML A primer for Web design students
Transcript
Page 1: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

and XML A primer for Web design students

Page 2: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Why PHP and XML?

Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior at cocktail parties?

Can’t I just develop all my information in HTML and leave it at that?

If I’m already using HTML on IIS on .NET, why would I want to use PHP and MySQL or XML with XSLT to generate XHTML and XSL-FO to generate PDFs?

Page 3: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Disoriented paranoid state of mind caused by excessive exposure to an overwhelming number of technology acronyms and buzzwords. Easily cured by this presentation.

Acronymophobia (ăk'rə-nĭmă'fōbē-ə) n.

Page 4: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Today, we’ll cover…

1. PHP and MySQL for dynamic web pages

2. XML Overview

3. XML terms and processes

4. XML transformations

5. XML software

6. Impact of XML

Page 5: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

1. What is PHP?

Originally “Personal Home Page,” a variant of Perl scripting language.

Open-source language for server-side scripting applications.

Works with variety of relational databases to create dynamic web sites on just about any server platform.

Page 6: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

index.html

résumé.html writing.html presentations.html

Web Server

Static Web Pages

Page 7: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

index.php

Dynamic Web Pages

Web Server

Template

XHTML

Page 8: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Basic PHP Template

<html>

<body>

<?php echo "Hello World"; ?>

</body>

</html>

Page 9: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

PHP Variables

<?php

$txt="Hello World";

echo $txt;

?>

Page 10: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

PHP Conditionals

<?php

$d=date("D");

if ($d=="Fri")

echo "Have a nice weekend!";

else

echo "Have a nice day!";

?>

Page 11: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

PHP Functions

Similar to JavaScript functions, but more powerful. More than 700 unique functions.

phpinfo( ) function - used for outputting information

phpforms ( ) function - inputting information to database

Page 12: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

PHP Form Function

<form action="welcome.php” method="POST">

Enter your name: <input type="text" name="name" />

Enter your age: <input type="text" name="age" />

<input type="submit" />

</form>

Page 13: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

PHP Example

English Department reservation system

Built from open-source program called MRBS (Meeting Room Booking System)

http://reserve.engl.iastate.edu/

Page 14: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

2. XML overview

XML is a metalanguage, i.e. a language that defines the rules and symbols of another language.

XML is not used on the web, but instead used to define other markup languages, such as XHTML, the replacement of HTML.

Allows us to define markup languages customized to our individual needs instead of relying on pre-existing tags.

Page 15: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Think of XML as….

An indented outline of a very large document. A database table expressed via element tags

within one big flattened text file. A family of technologies that work in tandem to

express information in a variety of ways. The Rosetta Stone of the information age,

allowing you to move information from one context to another through a standardized structure.

Page 16: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

XML Example<address type=“home”>

<name>

<first>Lee</first>

<last>Honeycutt</last>

</name>

<street>3938 Christytown Road</street>

<city>Story City</city>

<state>Iowa</state><zip length=“9”>50248-1234</zip>

</address>

Page 17: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Uses of XML

Provides a simpler method of structuring large data sets compared to earlier tagging systems like SGML.

Publishes information to various media formats from a single source.

Serves as a platform-independent lingua franca for sharing hierarchically structured information between various programs.

Embeds links in RSS feeds for news and weblogs.

Page 18: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Impact of XML

Provides greater flexibility in organizing information, but also introduces greater complexity.

Requires greater upfront planning and design of information sets and their rhetorical use.

Separates content from style, which has huge rhetorical implications.

Page 19: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

3. Key XML Terms & Processes

Elements - similar to HTML <tags>, but defined by the user instead. They describe, in human language, the data they surround.

Attributes - name and value pairs used to distinguish unique instances of an element.

Entities - shorthand placeholders for information used often within a document

DTDs & Schemas - declared dictionaries of elements that model a document’s content.

Page 20: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

XML Example<address type=“home”>

<name>

<first>Lee</first>

<last>Honeycutt</last>

</name>

<street>3938 Christytown Road</street>

<city>Story City</city>

<state>Iowa</state><zip length=“9”>50248-1234</zip>

</address>

Page 21: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Purpose of DTDs & Schemas

Define the set of allowed tags and attributes in the document.

Describe a document’s content model using rules by which tags and data are ordered.

Provide easy model management through references to shortcuts and external files.

Page 22: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Anatomy of a DTD

Entity - shorthand name/value pairs that make XML docs easier to write and parse. Similar to a Word macro. EX: <!ENTITY isu “Iowa State University”>

Elements - define actual markup tags. EX:<!ELEMENT name (first, middle?, last)><!ELEMENT street (#PCDATA)><!ELEMENT city (#PCDATA)>

Page 23: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Entity placed in a document

<!ENTITY isu “Iowa State University”><description>Though its claim to the first

digital computer is debatable, &isu; does have the world’s only six-sided virtual reality facility.</description>

When XML is parsed, &isu; expands to “Iowa State University”

Page 24: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

4. Transforming XML

XSL (Extensible Stylesheet Language) - special type of XML document that transforms XML data into styled format. Similar to HTML’s Cascading Stylesheets.

XSLT (Transformations) - usually used for transformation to XHTML.

XSL-FO (Formatting Objects) - used for page formats such as PDF and MS Word.

Page 25: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

XML Transformations

XML

DTD

XSLT

XSL-FO

XHTML

Page 26: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

XSLT stylesheets…

…contain two types of elements:Instructions - describe how nodes of

the XML document will be transformed.Literals - output text, such as XHTML

tags, that appear exactly as they appear in the stylesheet. Act as a template for XML content.

Page 27: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

Instructions & Literals

<table width="100%">

<tr>

<td colspan="2"><h1>Browse Record</h1></td>

</tr>

<tr>

<td><b>Database Name: </b><xsl:value-of select="fmrs:datasource/@database"/></td>

</tr>

</table>

Page 28: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

XPath

XPath - syntax for describing how nodes of an XML document are processed.

<xsl:apply-templates select=“expression”>

<xsl:for-each select= “expression”>

Conditionals <xsl:if test=“expression”> <xsl:choose>

<xsl:when> <xsl:otherwise>

<xsl:sort selection=“expression”>

Page 29: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

5. XML Software

Some applications are moving to XML as their foundation. EX: OpenOffice.

Most database programs have an XML export feature.

XML editors and companion components: Cross Platform - Editix, oXygen, Exchanger Windows - XML Spy, XMetal, and Stylus

Page 30: And XML A primer for Web design students. Why PHP and XML? Aren’t these just passing fad buzzwords to make cyber-snobbish people sound intelligently superior.

6. Impact of XML

Provides greater flexibility in organizing information, but also introduces greater complexity.

Requires greater upfront planning and design of information sets and their rhetorical use.

Separates content from style, which has huge rhetorical implications, just as does the use of CSS.


Recommended