Download presentation
Presentation is loading. Please wait.
1
CSE 103 Day 20 Jo is out today; I’m Carl
Sign up for a makeup if you haven’t taken one since the last in-class BT Must take one by Wednesday to get all your attempts in! More makeups coming later this week If you are not in the class, please save and log out.
2
Clients, Servers and PHP
What are servers? What are clients? What is PHP? How is PHP like HTML? How do you distinguish PHP code from HTML tags? Which computer executes the PHP code, the client or the server? What can you do using PHP that you can't do using HTML?
3
Serving HTML files requests http://www.msu.edu/user/sparty/day06.html
Server Client receives contents of U://msu/user/s/p/sparty/web/day06.html
4
Serving PHP files requests Client Server processes contents of U://msu/user/ s/p/sparty/web/ day20.php and returns results of processing receives result of PHP processing from server
5
Dreamweaver MX Start Dreamweaver by going to:
Start => Program Files => Development Apps => Web => Dreamweaver MX => Dreamweaver MX Seven parts of Dreamweaver window: Menu Bar Insert Panel Document Toolbar Document Window Properties Panel Files Panel Answers Panel
6
Creating a Web page Use Dreamweaver
Create an HTML file with the following paragraph: Welcome to my day 20 page for CSE 103. This page was created at 10:43AM on Thursday, March 24, 2005. If you look at the source, you will see that Dreamweaver has included the <html> <head> and <body> tags for you. Save the file in your web folder as day20.html
7
Testing your page Browse to your page using www.msu.edu
Does it look the way it should? Browse to your page using Does the page look the same?
8
Web Page Development Cycle
EDIT and SAVE the file in your AFS space p:\web\day20.html TEST by BROWSING to the page
9
Moving from HTML to PHP Now save the file as day20.php. Again browse to this file. Any differences? In Dreamweaver, after the introductory paragraph, add a sentence that says: This page created with PHP version: All PHP code must be enclosed between <?php and ?>. Enter these tags. Note that you must use Code View! Everything between these two tags is treated as PHP Between these tags, include the command: print phpversion();
10
PHP Before and After Save again and browse to this page
View the source code for this page in the browser Compare that code to the day20.php script as viewed in Dreamweaver What is the same between these two views? What is different between them?
11
Essence of PHP Start a "PHP block" with <?php
Coming soon from CK Start a "PHP block" with <?php Place one or more PHP commands next: Each command must end with a semicolon All HTML outside PHP blocks is ignored by PHP All PHP is run first, before the page loads No PHP is sent to browser Can output text inside PHP with print (or echo) Can use HTML tags with print to format, or put an open HTML tag before a PHP block and a close HTML tag after the block (examples next slide) Close PHP block with ?> You may have many PHP blocks on one page
12
PHP and HTML formatting
HTML formatting inside PHP blocks: <p>This page created with PHP <?php print "<i>"; print phpversion(); print "</i>"; ?></p> Displays as This page created with PHP 4.3.3 Notice use of multiple prints, semicolon after each one When printing literal strings (like the <i> tags), put them in quotes, just like in SQL We can open <?php … ?> blocks inside other HTML tags with no problem (this example is inside <p>…</p>) No extra space before/after <?php ?> helps keep the formatting right
13
Including Pages © 2005 by <your name here>
Create a file with an HTML fragment to contain your copyright notice: © 2005 by <your name here> Copyright symbol from Insert/Special Characters Do not include the standard tags (HTML, HEAD, BODY); only tags and text that go in the body of the page such as <p> or <b>. Save as copyright.php (in web folder). Now use the include() function to add this copyright notice into your day20.php file. For help, read the PHP Manual page on include() linked from today’s classwork page Look at examples, find one that's like what you want
14
Reading the Documentation 101
Use the link on the today’s Classwork page to see documentation for PHP function date() Look at the description line: string date ( string format [, int timestamp]) string date(…): string is the type returned (output) by the function. All functions need () string format: a required parameter. It has to be of string type [, int timestamp]: an optional parameter (indicated by []). If we include this, we must put a comma after the format. It must of type int (integer) Keep reading to find notes and examples of each parameter
15
Time Stamping a Page Use a PHP function to put a time stamp on your page date() writes date/time in a human-readable format See the Manual page linked to today’s class page Change the page so that it always displays the current time and date, i.e., replace: 10:43AM – Instead, show the time when the page is being viewed. Thursday, March 25, 2004 – Instead, show the date on which the page is being viewed.
16
Ultimate Bridge Task Work alone or in pairs (IF approved)
Create database in Access; we convert to MySQL Create website using PHP to interface with db Include pages to add/edit data; use those to get data into db (we don't import data from Access) If you have a large set of pre-existing data, send an and we'll work something out. Demonstrate mastery of topics taught in class and ability to extend knowledge beyond that (new functions, new types of queries, etc.)
17
More UBT information General abstract available on classwork page
Grading: 34% queries 22% design 24% PHP 12% General 8% HTML Work in pairs (if approved) but you lose 25% off the top and must do extra work to make up for that. Final grade: < 50%: 3.0; 50-74%: 3.5; 75%+ : 4.0
18
A good UBT should: Demonstrate good database design
Appropriate tables, fields, datatypes, keys, and relationships, as well as integrity and minimal redundancy (everything related to the 2.5 BT) Demonstrate mastery of various queries Both Select and Action, use of functions, calculated fields, inner/outer joins, aggregate functions, etc. (everything related to the 2.0, plus Action queries from the 1.5) Demonstrate ability to learn new concepts Use new functions, query types, etc. that we didn’t cover in-class or on any BT Many points here; don't miss this or you won't get 4.0
19
UBT Topics and Homework
There is a list of suggested topics on today’s classwork page with your first three choices ASAP (by this Friday, April 1 at latest) Homework: Read textbook and links from day 19 homework, if you haven't already Practice date formatting
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.