Title: Digital Media Technology
1Week 11 PHP3
Peter Verhaar
2Todays lecture
- Recapitulation (iteration, interactive web
pages) - Databases and Web Programming
- Web programming and Text analysis
- Arrays
- Functions
3Homework exercise Question 4
Webform.html
process.php
4Homework exercise Question 3
if ( condition1 ) Code block 1 elseif
( condition 2 ) Code block 2 else
Code block 3
5(No Transcript)
6distant reading vs. close reading
7(No Transcript)
8(No Transcript)
9(No Transcript)
10Questions
- What are be the main motivations for digitizing
millions of books? - Reading mediated by typography vs. mediation
through algorithms? - Can the latter actually be considered reading?
- What sort of knowledge can be produced through
algorithms? - How does the act of reading actually change under
the influence of technologies?
11title "Waiting for Godot"
titles array ("Waiting for Godot", "Endgame",
"Happy Days", Krapps Last Tape" )
12Arrays
- Used to define a collection / a list
- Can be declared with the array() function
lt?php titles array ("Waiting for Godot",
"Endgame", "Happy Days", Krapps Last Tape" ) ?gt
13Use of the array() function in this way will
create an automatic index
titles
0 Waiting for Godot
1 Endgame
2 Happy Days
3 Krapps Last Tape
14Addressing elements in the array
lt? titles array ("Waiting for Godot",
"Endgame", "Happy Days", Krapps Last
Tape ) print titles2 ?gt
15An indexed array
capitals array( "Italy"gt "Rome",
"Luxembourg"gt "Luxembourg", "Belgium"gt
"Brussels", "Denmark"gt Copenhagen",
"Finland"gt "Helsinki", "France"gt "Paris",
"Slovakia"gt "Bratislava", "Slovenia"gt
"Ljubljana", "Germany"gt "Berlin )
16Addressing an element in an indexed array
capitals array( "Italy"gt "Rome",
"Luxembourg"gt "Luxembourg", "Belgium"gt
"Brussels ) print capitals"Italy" //
this will print "Rome"
17(No Transcript)
18(No Transcript)
19file.php
url
Php parser
Client
array
MySQL
Server
20languages
eng English
dut Dutch
fre French
ger German
ita Italian
21Books database
print "ltselectgt" foreach ( languages as l
) print "ltoptiongt l lt/optiongt" print
"lt/selectgt"
22Functions
function ltname of functiongt (ltparametersgt)
code block
23Functions
function average(a, b) sum a b
average sum / 2 return average
print "The average of 7 and 9 is " .
average(7,9)