780 likes | 943 Views
PHP on a F ast Track and other web development techniques. a quick introduction to web programming b y Jarek Francik. Teaching Objectives. To ensure everyone of you have at least basic understanding of server-side processing To introduce some basic PHP
E N D
PHP on a Fast Trackand other web development techniques a quick introduction to web programming by JarekFrancik
Teaching Objectives • To ensure everyone of you have at least basic understanding of server-side processing • To introduce some basic PHP • To demonstrate what makes a good web project (and what doesn’t)
What is a project? A project is a temporary endeavour undertaken to create a uniqueproduct or service
A project is... • a defined, unique venture or undertaking, that • requires the effort or activities of people • who have defined roles and responsibilities • within a finite life-span, time-scale or schedule • using specified resources and budgets, and • has specific goals or objectives to achieve • to which measures of quality can be applied • that brings about some change in the status quo • to provide sustainable benefitto some business, organisational or individual need
Project Snettisham Research: • 50,000 birds swirling like smoke clouds • Oystercatchers, godwits, knots... • Snettisham RSPB Reserve in Norfolk • Best time: autumn, when most birds migrate LOOK FOR MORE INFORMATION!
Project Snettisham Research (cont.): • The flocks take to the air as the high tide races in, covering their feeding grounds. They sit out high tide and return once the tide falls • Spectaculars happen only in the mornings • The higher the tidethe better chances to see it!
Project Snettisham • Need a really high tide early in the morning... • UK Tides (Apple Store) USE PROPER TOOLS!
Project Snettisham • Need a really high tide early in the morning... • UK Tides (Apple Store) • Timetables ready on the RSPB site! USE VARIOUS SOURCES OF INFORMATION
Project Snettisham • Need a really high tide early in the morning... • UK Tides (Apple Store) • Timetables ready on the RSPB site! • Three days trip 17-19 Nov (to also see the Pink Footed Geese!) PLANNING IS CRUCIAL
Project Snettisham • Need a really high tide early in the morning... • UK Tides (Apple Store) • Timetables ready on the RSPB site! • Three days trip 17-19 Nov (to also see the Pink Footed Geese!) • Accommodation! PLANNING IS CRUCIAL
Project Snettisham • Need a really high tide early in the morning... • UK Tides (Apple Store) • Timetables ready on the RSPB site! • Three days trip 17-19 Nov to see the Pink Footed Geese as well! • Accomodation! • Transport... • Anything else... PLANNING IS CRUCIAL
What is a project? A project is a temporary endeavour undertaken to create a uniqueproduct or service • Snettisham Trip is a project • A trip to Winkworth Arboretum last Saturday wasn’t a project why?
What is a project? A project is a temporary endeavour undertaken to create a uniqueproduct or service • A bespoke e-commerce solution for a company who need it is a project • A novel HCI solution is a project • A routine PC maintenance is not a project why?
What is a project? A project is a temporary endeavour undertaken to create a uniqueproduct or service • A typical on-line store for a small company...hardly is a good project why?
Client & Server Client Server
Client & Server Client Server
Client & Server Remote File System Client Server
Client & Server Remote File System REQUEST: GET RESPONSE: HTML Client Server
Client & Server Remote File System CLIENT SIDE PROCESSING REQUEST: GET RESPONSE: HTML Files served over the network may contain HTML, CSS, JavaScript,Flash and may be pretty much complex! Client Server
Client & Server Remote File System REQUEST: GET RESPONSE: HTML Client Server
Client & Server Remote File System REQUEST: GET RESPONSE: HTML REQUEST: GET RESPONSE: HTML Client Server
Client & Server Remote File System REQUEST: POST RESPONSE: HTML REQUEST: POST DB RESPONSE: HTML Client Server
Client & Server Remote File System REQUEST: POST RESPONSE: PHP REQUEST: POST DB RESPONSE: PHP Great Hiking Shoe Perfect Company Client Server SERVER SIDE PROCESSING
Client-Side Processing Server-Side Processing DB
Client-Side Processing Server-Side Processing Executed remotely, on a web server Results must be sent over the network Network latency Pages must be re-loaded in order to view the results* Information easily shared Database back-end Flexible and powerful security control * AJAX technology allows for remote updates without pages being reloaded but technically it is a combination of server side and client side technologies • Executed locally, on client’s computer • Results visible immediately • Fast & dynamic • Processing within a single webpage • Information cannot be shared • No Databases* • Keeping things secret is very difficult – everything is on the user’s computer * Limited local database functionality is available in HTML5, but without sharing
PHP • Scripting language for web development • Created by RasmusLerdorf 16 years ago • Currently phasing out • Easy to learn but time-consuming to use
What do we need? • Operating System • Web Server • Database • Scripring Language Windows, Linux, MacOS... Appache, IIS, WEBrick... MySQL, Postgres, SQLite, Oracle... PHP, Perl, Python, Ruby, C#, Java... DB
What do we need? • Operating System • Web Server • Database • Scripring Language Windows, Linux, MacOS... Appache, IIS, WEBrick... MySQL, Postgres, SQLite, Oracle... PHP, Perl, Python, Ruby, C#, Java... DB
What do we need? • Operating System • Web Server • Database • Scripring Language Linux, Windows, MacOS... Appache, IIS, WEBrick... MySQL, Postgres, SQLite, Oracle... PHP, Perl, Python, Ruby, C#, Java... DB
What do we need? • Operating System • Web Server • Database • Scripring Language MacOS, Windows, Linux... Appache, IIS, WEBrick... MySQL, Postgres, SQLite, Oracle... PHP, Perl, Python, Ruby, C#, Java... DB
What do we need? • Operating System • Web Server • Database • Scripring Language X - Platform Appache MySQL PHP Perl DB
What do we need? • Operating System • Web Server • Database • Scripring Language X A M P P DB
XAMPP http://www.apachefriends.org/en/xampp.html or google for “xampp”
XAMPP • Download and install – it’s easy • Run XAMPP Control Panel • Start Apache & MySql • Run in your browser:http://localhost • Click Explore and goto htdocsto browseyour web files • Use MySql Admin tosetup your databasewith mySqlAdmin
KU Server • There is a web server available for you at http://studentnet.kingston.ac.uk • Find all details there (or check the end of this presentation)
Database structure (SQL) USE test; CREATE TABLE goods ( id int(6) unsigned NOT NULL auto_increment, item varchar(100) NOT NULL default '', price decimal(6,2) NOT NULL default '0.00', image varchar(100) NOT NULL default '', PRIMARY KEY (id) ); INSERT INTO goods VALUES (1, 'Soap', '4.99'); INSERT INTO goods VALUES (2, 'Strawberry Jam', '1.99'); INSERT INTO goods VALUES (3, 'Toothpaste', '2.49'); INSERT INTO goods VALUES (4, '8GB Memory Stick', '22.99');
The First PHP File <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Your Cart</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h1>Your Cart</h1> <?php ?> </body> </html> cart.php 0
The First PHP File <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Your Cart</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h1>Your Cart</h1> <?php echo "Hello, world!"; ?> </body> </html> cart.php