* Lecture 5 PHP Basics * Course logo spider web photograph from Morguefile openstock photograph by Gabor Karpati, Hungary.

Slides:



Advertisements
Similar presentations
Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Advertisements

Introduction to JavaScript
Introduction to PHP Dr. Charles Severance
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
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”
PHP == ‘ Hypertext Preprocessor ’ Open-source, server-side scripting language Used to generate dynamic web-pages PHP scripts reside between reserved PHP.
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Copyright © Curt Hill PhP History and Introduction.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
Nael Alian Introduction to PHP
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
PHP - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
PHP Open source language for server-side scripting Works well with many databases (e.g., MySQL) Files end in.php,.php3 or.phtml Runs on all major platforms.
Strings, output, quotes and comments
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
PHP Workshop ‹#› أطلق إبداعك 2 أطلق إبداعك 2 مدرس معتمد من مركز زووم PHP: The Basics.
Chap 2 – Getting Started COMP YL Professor Mattos.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
Creating PHP Pages Chapter 5 PHP Structure and Syntax.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Session 2: PHP Language Basics iNET Academy Open Source Web Development.
1 CS428 Web Engineering Lecture 22 Building Dynamic Web pages (PHP - V)
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
PHP using MySQL Database for Web Development (part II)
Module 1 Introduction to JavaScript
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
JavaScript Syntax and Semantics
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
PHP Introduction.
Intro to PHP & Variables
Web Systems Development (CSC-215)
* Lecture 26 Manifest Asynchrony
Server Side Programming Overview And file system basics
Introduction to Databases with MAMP/LAMP/WAMP thrown in!
CT Web Development, Colorado State University
* Lecture 12 Mapping, Map Reduction Summing integers,
HTML5 Drawing Canvas and Video
Handling Files In particular, uploading files.
Tables from Arrays of Objects Exploding Strings
Content Management and WordPress
HTML Basics & Context & IDEs & Server Basics & Online Notes
Introduction to AJAX and the migration toward applications
MySQL Tables and Relations 101
Querying Client Information Forms and Passing Data,
* jQuery * Course logo spider web photograph from Morguefile openstock photograph by Gabor Karpati, Hungary.
PHP Intro/Overview Bird Book pages 1-11,
Authentication Stepped Up Persistent User Data Protected Content.
PHP.
Basics.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Intro to PHP.
Server Side Programming Overview And file system basics
PHP an introduction.
Loops and Conditionals Generating , Reading files.
Alternatives to our approach
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

* Lecture 5 PHP Basics * Course logo spider web photograph from Morguefile openstock photograph by Gabor Karpati, Hungary.

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Learn PHP in 5 easy steps! (people who try to get views on their articles HATE THIS!) 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

Put dollar signs in front of variables. 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

Change String Concatenation Operators 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Remove Types 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

Call a function a function 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

Change function call punctuation 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Example – 00 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Basics Server runs all .php files through PHP interpreter before sending to client Special language constructs pretend to be functions These include print, echo, include, require, return, exit, array <?php print “Hello World!”; ?> Vs. <? 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Echo, Print, Comments echo and print both output strings echo allows for multiple parameters to be passed print acts more like a function and only allows one // and # comment out single lines /* blah blah */ comment out blocks of text 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz PHP Variables Start with $ - always! Case sensitive, and can contain letters, underscores and numbers $exNumText, $1_exNumText, $_1exNumText, $_exNumText No type declarations are needed Automatic type conversion Automatic substitution, except in ‘ ‘ 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Include() Interpreter drops out of PHP mode when processing included files, then drops back in when it’s done <?php echo “Sometimes I like to play with “; include (‘dogs.php’); echo “.”; ?> Outputs: Sometimes I like to play with dogs more than cats. The processor runs it like: echo “Sometimes I like to play with ”; echo “dogs more than cats”; 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Example 01 This example introduces: The use of a variable The use of include files Most important, dynamic content! 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Header and Footer Reuse Common Components 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz HTML for Example 01 At the risk of being repetitive: from a client browser perspective there is no such thing as PHP. CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz 11/27/2018

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Keep your style ! Note: this is a ‘vintage slide’ showing older xml header and Bluefish editor. 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

Date() & Other Functions Functions are not case sensitive They ignore whitespace Date allows for several variables to be passed for different formats Explicitly set the time zone date_default_timezone_set('America/Denver'); For a complete list of arguments http://us3.php.net/manual/en/function.date.php 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Example 02 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Heavy Reliance on echo Note large PHP block, single quotes, double quote new lines in this example. Double quote Function call HTML new line Leading Space String Concatenation New line You must master control of all these interacting features. Must you always use them – next slide. 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Example 02 Clean I am strongly moving toward this more sparing use of PHP, but be aware and able to use both styles. 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz

CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz Example 02 Cleaner 11/27/2018 CSU CT 310 Web Development ©Ross Beveridge & Jaime Ruiz