Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 116 Introduction to Web Development and PHP.

Similar presentations


Presentation on theme: "CSCI 116 Introduction to Web Development and PHP."— Presentation transcript:

1 CSCI 116 Introduction to Web Development and PHP

2 Objectives Understand Web development Understand Web development Learn/review HTML Learn/review HTML Create your first PHP script Create your first PHP script 2

3 WWW – Basic Terms Web page Web page A document (file) on the WebA document (file) on the Web URL URL Uniform Resource LocatorUniform Resource Locator A unique address that identifies a Web pageA unique address that identifies a Web page Example: A Web site A Web site A collection of related Web pages and filesA collection of related Web pages and files 3

4 Web Browsers and Servers Web browser Web browser A program used to display a Web pageA program used to display a Web page Interprets HTML codeInterprets HTML code Internet Explorer, Mozilla Firefox, Google ChromeInternet Explorer, Mozilla Firefox, Google Chrome Web server Web server A computer that delivers Web pages A computer that delivers Web pages ApacheApache Microsoft Internet Information Services (IIS)Microsoft Internet Information Services (IIS) 4

5 HTML Documents Web pages are created using Hypertext Markup Language (HTML) Web pages are created using Hypertext Markup Language (HTML) Defines what and how elements appear in a Web browserDefines what and how elements appear in a Web browser Uses tags to format text and insert elementsUses tags to format text and insert elements Tags are enclosed in brackets ( ) Tags are enclosed in brackets ( ) Each opening tag ( ) Each opening tag ( ) 5 This text will appear as bold. This text will appear as bold. Opening tag Element Closing tag

6 The World Wide Web Consortium (W3C) Established in 1994 at MIT to oversee the development of Web technology standards Established in 1994 at MIT to oversee the development of Web technology standards Decided XHTML 1.0 would not include some common HTML elements for display and formatting Decided XHTML 1.0 would not include some common HTML elements for display and formatting Elements and attributes that will eventually be eliminated are deprecatedElements and attributes that will eventually be eliminated are deprecated 6

7 Writing Well-Formed Documents XHTML documents must… XHTML documents must… Include a declarationInclude a declaration Include,, and elementsInclude,, and elements Use as the root elementUse as the root element Place attribute values in quotation marksPlace attribute values in quotation marks Properly nest all elementsProperly nest all elements 7

8 Sample HTML File Toner Cartridge Sales Toner Cartridge Sales Lexmark Toner Cartridges Model #: LEX Compatibility: Optra 4049/3112 Price: $ Model #: LEX Compatibility: Lexmark 4019/4028 Price: $

9 Sample HTML File 9

10 Creating an HTML Document HTML editors HTML editors Graphical EditorsGraphical Editors Dreamweaver Dreamweaver Microsoft Expression Microsoft Expression SeaMonkey SeaMonkey Text-based editorsText-based editors Komodo Komodo Notepad++ Notepad++ UltraEdit UltraEdit

11 Web Communication Protocols Protocol Domain name Directory Filename Protocol Domain name Directory Filename 11 Domain identifier

12 Publishing Your Web Site Web hosting refers to the publication of a Web site for public access Web hosting refers to the publication of a Web site for public access Any computer may be a Web server Any computer may be a Web server Consider speed, size, and security issuesConsider speed, size, and security issues Must register a unique domain name Must register a unique domain name Master database maintained by InterNICMaster database maintained by InterNIC Most ISPs offer Web hosting Most ISPs offer Web hosting 12

13 Cascading Style Sheets W3C recommends using Cascading Style Sheets to format Web pages W3C recommends using Cascading Style Sheets to format Web pages A single piece of CSS formatting information is referred to as a style A single piece of CSS formatting information is referred to as a style Example: Text alignmentExample: Text alignment The term cascading refers to the ability for Web pages to use CSS information from more than one source The term cascading refers to the ability for Web pages to use CSS information from more than one source 13

14 Understanding Web Development Web development refers to the design of software applications for a Web site Web development refers to the design of software applications for a Web site Also called Web programmingAlso called Web programming Different from Web design Different from Web design The visual design and creation of Web pagesThe visual design and creation of Web pages Different from Web page authoring Different from Web page authoring The creation and assembly of the content that makes up a Web page.The creation and assembly of the content that makes up a Web page. 14

15 Client/Server Architecture Client (front end): Client (front end): Presents an interface to the userPresents an interface to the user Gathers information from the user and submits it to a serverGathers information from the user and submits it to a server Receives, formats, and presents the results returned from the serverReceives, formats, and presents the results returned from the server Server (back end) Server (back end) Fulfills a request for information by managing the request and serving the requested information to the clientFulfills a request for information by managing the request and serving the requested information to the client May involve communication with a databaseMay involve communication with a database 15

16 Client/Server Architecture 16 A two-tier system consists of a client and a server A two-tier system consists of a client and a server

17 Client/Server Architecture A three-tier, or multi-tier, system consists of three distinct pieces: A three-tier, or multi-tier, system consists of three distinct pieces: Client tierClient tier User-interface tier; A Web browser User-interface tier; A Web browser Processing tierProcessing tier Middle tier Middle tier Data storage tierData storage tier The database The database 17

18 Client/Server Architecture

19 Client-Side Scripting Client-side scripts are programs that run on the client tier, in the browser Client-side scripts are programs that run on the client tier, in the browser JavaScript JavaScript Allows the development of interactive Web pages and sitesAllows the development of interactive Web pages and sites Create applications such as games or calculators Create applications such as games or calculators Change the contents of a Web page after a browser has rendered it Change the contents of a Web page after a browser has rendered it Create visual effects such as animation Create visual effects such as animation Used in most Web browsersUsed in most Web browsers 19

20 Server-Side Scripting Server-side scripts are executed on a Web server Server-side scripts are executed on a Web server Used to develop interactive Web sites Used to develop interactive Web sites Supports many types of databases Supports many types of databases Languages Languages ASP.NET (Microsoft)ASP.NET (Microsoft) JSP (Java)JSP (Java) Ruby on RailsRuby on Rails PHPPHP 20

21 Server-Side Scripting and PHP Use client-side scripting to handle user interface processing and light processing, such as validation; use server-side scripting for intensive calculations and database access. 21

22 Creating Basic PHP Scripts PHP is an embedded scripting languages PHP is an embedded scripting languages Code is embedded within a Web pageCode is embedded within a Web page JavaScript is also embedded, but executes on the clientJavaScript is also embedded, but executes on the client PHP code executes on the Web server PHP code executes on the Web server Server sends the page to the scripting engine for processingServer sends the page to the scripting engine for processing Server returns results of PHP script along with HTML/XHTML elements to the clientServer returns results of PHP script along with HTML/XHTML elements to the client PHP code is never sent to a clients Web browser PHP code is never sent to a clients Web browser A Web page containing any PHP code must have a.php extension A Web page containing any PHP code must have a.php extension 22

23

24 Creating PHP Code Blocks Code declaration blocks are blocks of PHP code within a Web page Code declaration blocks are blocks of PHP code within a Web page To declare a PHP block: To declare a PHP block: Standard PHP script delimitersStandard PHP script delimiters 24

25 Functions A function refers to a procedure that performs a specific task A function refers to a procedure that performs a specific task To execute a function, you must call it from somewhere in the script To execute a function, you must call it from somewhere in the script Function name is always followed by parenthesesFunction name is always followed by parentheses Parentheses contain any data the function needsParentheses contain any data the function needs Example:Example: 25

26 Displaying Script Results To return to the client the results of processing that occurs within a PHP code block, use echo() or print() To return to the client the results of processing that occurs within a PHP code block, use echo() or print() A text string, is text contained within double or single quotation marks A text string, is text contained within double or single quotation marks 26 print Hello world; echo Hello world; print Hello world; print Hello. world!;

27 Creating Multiple Code Declaration Blocks You can have multiple PHP blocks within a page You can have multiple PHP blocks within a page Multiple Script Sections Multiple Script Sections First Script Section First Script Section Second Script Section Second Script Section 27

28 Creating Multiple Code Declaration Blocks PHP code declaration blocks execute on server before Web page is sent to client PHP code declaration blocks execute on server before Web page is sent to client Multiple Script Sections Multiple Script Sections First Script Section First Script Section Output from the first script section. Output from the first script section. Second Script Section Second Script Section Output from the second script section. Output from the second script section. 28

29 29

30 Adding Comments to a PHP Script Comments are nonprinting lines placed in code such as: Comments are nonprinting lines placed in code such as: The name of the scriptThe name of the script Your name and the program creation dateYour name and the program creation date Explanation of codeExplanation of code Line comments comment a line Line comments comment a line Add // before the textAdd // before the text Block comments comment multiple lines Block comments comment multiple lines Add /* to the first line of codeAdd /* to the first line of code And */ after the last character in the codeAnd */ after the last character in the code 30

31 Adding Comments to a PHP Script 31


Download ppt "CSCI 116 Introduction to Web Development and PHP."

Similar presentations


Ads by Google