1 Some Variations on Date Display 2 Print HTML Code What PHP prints will be placed into the file, and then the file is sent to the web client to be rendered.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1-1 The Web Wizards Guide to PHP by David A. Lash.
Advertisements

XHTML Week Two Web Design. 2 What is XHTML? XHTML is the current standard for HTML Newest generation of HTML (post-HTML 4) but has many new features which.
Hypertext markup language.  Client asks for an html file  Server returns the html file  Client parses and displays it  This display is what most people.
INTRODUCTION TO HYPERTEXT MARKUP LANGUAGE 1. Outline  Introduction  Markup Languages  Editing HTML  Common Tags  Headers  Text Styling  Linking.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
2440: 211 Interactive Web Programming JavaScript Fundamentals.
Chapter 4 Marking Up With Html: A Hypertext Markup Language Primer.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Beginning Web Site Creation: Dreamweaver CS4 Noreen Brown XHTML CODING -- TAGS.
13 February Building a Web Page. HTML Files Two types of information Text Instructions on how to display Instructions are in the form of tags Tags are.
1 Web Wizards Guide To PHP David Lash Chapter 1 Introduction to PHP.
 2008 Pearson Education, Inc. All rights reserved. 1 Introduction to HTML.
Marking Up With Html: A Hypertext Markup Language Primer
Escaping Characters document.write(). Learning Objectives By the end of this lecture, you should be able to: – Recognize some of the characters that can.
Chapter 4 Mixing PHP and HTML  In this chapter, you’ll learn how to do the following: -Recognize and use the different kinds of PHP start and end tags.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
PHP Workshop ‹#› PHP: The Basics. PHP Workshop ‹#› What is it? PHP is a scripting language commonly used on web servers. –Stands for “PHP: Hypertext Preprocessor”
Chapter 4 Fluency with Information Technology L. Snyder Marking Up With HTML: A Hypertext Markup Language Primer.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
Regular Expressions Week 07 TCNJ Web 2 Jean Chu. Regular Expressions Regular Expressions are a powerful way to validate and format text strings that may.
Copyright © 2003 Pearson Education, Inc. Slide 1-1 Web Design & Development PHP.
Tutorial 14 Working with Forms and Regular Expressions.
HTML (HyperText Markup Language)
1 PHP Variables. 2 What is a variable? A variable is something that can be changed – a thing that can take on any value from a possible set of values.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
Extensible Hypertext Markup Language A successor to HTML 4.01 XML-compliant W3C is improving and expanding.
Chapter 4: Hypertext Markup Language Primer TECH Prof. Jeff Cheng.
Images in HTML PowerPoint How images are used in HTML.
ITEC 745 Instructional Web Authoring I Instructor: Ray Cole Week 8.
HTML 4 Foundation Level Course HyperText Markup Language Most common language used in creating Web documents. You can use HTML to create cross-platform.
HTML CRASH COURSE. What is HTML?  Hyper Text Markup Language  The language used to make web pages  Written by using tags.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ HTML Training.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. August 25, 2010—All HTML code brought to XHTML standards.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
Strings, output, quotes and comments
JavaScript Syntax, how to use it in a HTML document
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
L. Anne Spencer (c) 2001 Basic Web Design Document, text, & layout formatting tags & attributes.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
1 Server versus Client-Side Programming Server-SideClient-Side.
HTML Links HTML uses a hyperlink to another document on the Web.
Web Authoring with Dreamweaver. Unit Objectives  Be able to define keywords: HTML, HTTP (protocol), browser, web server, client/server, tag, attribute,
1 An Introduction to Dreamweaver and PHP Part B: Some introductory PHP and JavaScript.
CSD 340 (Blum)1 Errors and Debugging and Swapping Variable Values.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
Chapter 2 print / println String Literals Escape Characters Variables / data types.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
HTML HTML stands for Hyper Text Markup Language. HTML is used in making the base of a Website You can just use an online website maker like weebly.com.
Chapter 2 1.What is the difference between print / println 2.What are String Literals 3.What are the Escape Characters for backslash, double quotataions,
Objective Write simple computer program in C++ Use simple Output statements Become familiar with fundamental data types.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Marking Up with XHTML Tags describe how a web page should look
Intro to PHP & Variables
HTML.
Marking Up with XHTML Tags describe how a web page should look
Marking Up with XHTML Tags describe how a web page should look
Introduction to XHTML Cont:.
Marking Up with XHTML Tags describe how a web page should look
PHP Variables.
Marking Up with XHTML Tags describe how a web page should look
The Web Wizard’s Guide to PHP by David A. Lash
Presentation transcript:

1 Some Variations on Date Display

2 Print HTML Code What PHP prints will be placed into the file, and then the file is sent to the web client to be rendered. Thus PHP can write anything that the web client will understand. In the above example, it is writing HTML. It writes a bold tag, then the date, then a closing bold tag. Note that if we want to print something as is (e.g. ), we put it in quotation marks. (That’s called a literal.)

3 Result of PHP writing HTML bold tags around the date.

4 Having PHP write HTML tags with attributes Next let us write the code that displays an image corresponding to the day of the week. The HTML we want written is or etc. The PHP code date(‘l’) will take care of the day of the week. (That’s a small ell.) The real problem is that the PHP code requires quotation marks and the desired HTML code also has quotation marks and we need to keep these distinct.

5 Escape sequences To distinguish HTML quotes from PHP quotes, we use what is called an escape sequence. The HTML quotes are preceded by a back slash (\”). The back slash now also becomes special and so if we want a back slash we have to write \\. (For other escape sequences, see column 1 of the PHP 4 Reference Card (Gould) under special characters.)

6 Rules of thumb for quotes In an escape sequence, the backslash always precedes the quote. –(Some people want to reverse the order for a closing quote, but that’s wrong.) The overall number of quotes must be even. The overall number of \” must also be even. Occurrences of \” must always be inside regular quotes.

7 PHP writing a image tag

8 The result of PHP writing a image tag

9 Following the rules print "<img src=\"act_"; print date('l'); print ".gif\" width=\"50px\" />"; Note in the above example –The back slashes are always before the quotes –The overall number of quotes is 8 (which is even) –The overall number of \” is 4 (which is even) –The \” are always inside pairs of regular quotes

10 Another approach is to place the PHP code right in the middle of an HTML tag.

11 The other approach gives the same result.

12 PHP can also write JavaScript

13 “I can cause accidents, too” Missing semicolon

14 Do not become obsessed with the line you are told the error is on. Missing quote

15 Errors can occur at different stages. Missing \” Error is not in PHP but in the HTML that was written. Look for mistake by viewing the source.

16 The PHP was OK, but it did not write good HTML. Missing quote in HTML