72
<Hmidi Hamdi>

Les Basiques - Web Développement HTML5, CSS3, JS et PHP

Embed Size (px)

Citation preview

Page 1: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

<Hmidi Hamdi>

Page 2: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Hmidi HamdiWeb & Mobile DeveloperSoftware Engineering @ ISSATSoFounder & Member @ IGC JSA @ JCertif Tunisia

Page 3: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Agenda

- Basic Notations(URL , WWW , HTTP , Web ...)- Static and dynamic Web sites - HTML & CSS & JS Basics - Client/Server Architecture and PHP & MYSQL Basics- Git basics and TeamWork agil methods (Scrum)

Page 4: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

IGC Projects2015-2016

Page 5: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP
Page 6: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP
Page 7: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP
Page 8: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP
Page 9: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP
Page 10: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Basic Notations

Page 11: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is Internet ?

The Internet is essentially a global network of computing resources. You can think of the Internet as a physical collection of routers and circuits as a set of shared resources.

Page 12: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Internet Based-Services● Email − A fast, easy, and inexpensive way to communicate with other Internet

users around the world.

● Telnet − Allows a user to log into a remote computer as though it were a local

system.

● FTP − Allows a user to transfer virtually every kind of file that can be stored on a

computer from one Internet-connected computer to another.

● UseNet news − A distributed bulletin board that offers a combination news and

discussion service on thousands of topics.

● World Wide Web (WWW) − A hypertext interface to Internet information

resources.

Page 13: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

WWW (World Wide Web)

A technical definition of the World Wide Web is − All the resources and users on the Internet that are using the Hypertext Transfer Protocol (HTTP).

Page 14: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTTPHTTP stands for Hypertext Transfer Protocol. This is the protocol

being used to transfer hypertext documents that makes the World

Wide Web possible.

A standard web address such as Yahoo.com is called a URL and here

the prefix http indicates its protocol.

Page 15: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

URLURL stands for Uniform Resource Locator, and is

used to specify addresses on the World Wide Web.

A URL is the fundamental network identification for

any resource connected to the web (e.g., hypertext

pages, images, and sound files).

Page 16: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is Website ? It is a collection of various pages written in HTML

markup language. Similarly, there are millions of

websites available on the web.

Page 17: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is Web Server ? Every Website sits on a computer known as a Web server. This

server is always connected to the internet. Every Web server that is

connected to the Internet is given a unique address made up of a

series of four numbers between 0 and 256 separated by periods. For

example, 68.178.157.132 or 68.122.35.127.

Page 18: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is Web Browser ? Web Browsers are software installed on

your PC. To access the Web you need a

web browsers, such as Netscape

Navigator, Microsoft Internet Explorer or

Mozilla Firefox.

Page 19: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is SMTP Server ? SMTP stands for Simple Mail Transfer Protocol

Server. This server takes care of delivering emails

from one server to another server. When you send

an email to an email address, it is delivered to its

recipient by a SMTP Server.

Page 20: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is ISP ? ISP stands for Internet Service Provider.

They are the companies who provide you

service in terms of internet connection to

connect to the internet.

Page 21: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is HTML ? HTML stands for Hyper Text Markup Language. This is the language

in which we write web pages for any Website. Even the page you are

reading right now is written in HTML.

This is a subset of Standard Generalized Mark-Up Language (SGML)

for electronic publishing, the specific standard used for the World

Wide Web.

Page 22: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is DNS ? DNS stands for Domain Name System. When someone types in your

domain name, www.example.com, your browser will ask the Domain

Name System to find the IP that hosts your site. When you register

your domain name, your IP address should be put in a DNS along

with your domain name. Without doing it your domain name will not

be functioning properly.

Page 23: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What is W3C ? W3C stands for World Wide Web Consortium which is an

international consortium of companies involved with the Internet and

the Web.

The W3C was founded in 1994 by Tim Berners-Lee, the original

architect of the World Wide Web. The organization's purpose is to

develop open standards so that the Web evolves in a single direction

rather than being splintered among competing factions. The W3C is

the chief standards body for HTTP and HTML.

Page 24: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Web Devloper and Web Designer A Web Designer

• Designs the look and feel of a website (creative side of

website)

• Decides the layout, fonts, color, images and overall

branding

• Creates the visual mock-up of the website

• Rarely does the development of a website!

• A Right-brained (Creative) Person

A Web Developer

• Brings the website mock-up to life on the Internet

(development side of website)

• Develops the website and hosts on a web server

• Has Web Development Skills: HTML, CSS, JavaScript,

PHP, Perl, Python, Java, Ruby

• A Left-brained (Logical) Person

Page 25: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

FrontEnd and BackEndFront End Web Development

• Defined components on the page with HTML

• Make them look pleasing with CSS

• Enable interactivity with JavaScript

• Enhance productivity with use of frameworks

Back End Web Development

• Create the page components and content dynamically on

the web server

• Send the HTML + CSS + JavaScript to web browser

(used by a human user)

• Generate pages by programming in Java, JavaScript,

PHP, Perl, Python, Ruby

• Aim to achieve fast response times to end users

Page 26: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Static Web HTML5, CSS3 and JavaScript

Page 27: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Static Web

Page 28: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

OverviewHTML • Hypertext Markup Language • Structure of Page JavaScript • Interactivity with User • Dynamic Updates in a Web Page

CSS • Cascading Style Sheets • Presentation/Styling

Page 29: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Hello World ! <!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>

</html>

Page 30: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML ElementsHTML elements are written with a start tag, with an end tag, with the content in between:

<tagname>content</tagname>

Page 31: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML AttributesHTML elements can have attributes

Attributes provide additional information about an element

Attributes are always specified in the start tag

Attributes come in name/value pairs like: name="value"

<tagname attName=”AttValue”>content</tagname>

Page 32: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML HeadingsHTML headings are defined with the <h1> to <h6> tags:

<h1>This is a heading</h1><h2>This is a heading</h2><h3>This is a heading</h3>

Page 33: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML ParagraphsHTML paragraphs are defined with the <p> tag:

<p>This is a paragraph.</p><p>This is another paragraph.</p>

Page 34: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML LinksHTML links are defined with the <a> tag:

<a href="http://www.w3schools.com">

This is a link

</a>

Page 35: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML ImagesHTML images are defined with the <img> tag.

The source file (src), alternative text (alt), and size (width and height) are provided as attributes:

<img src="w3schools.jpg" alt="W3Schools.com"

width="104" height="142">

Page 36: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

The HTML Style AttributeThe HTML style attribute has the following syntax:

style="property:value"

The property is a CSS property. The value is a CSS value.

Use ba

ckgrou

nd-co

lor fo

r back

groun

d colo

r

Use col

or for

text

colors

Use fon

t-fam

ily for

text

fonts

Use fon

t-size

for te

xt siz

es

Use tex

t-align

for te

xt alig

nmen

t

Page 37: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

HTML Formatting Elements<p><strong>This text is strong</strong>.</p>

<p><i>This text is italic</i>.</p>

<p><em>This text is emphasized</em>.</p>

<h2>HTML <mark>Marked</mark> Formatting</h2>

<p>My favorite color is <del>blue</del> red.</p>

<p>My favorite <ins>color</ins> is red.</p>

<p>This is <sub>subscripted</sub> text.</p>

<p>This is <sup>superscripted</sup> text.</p>

Page 38: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

CSS3

CSS stands for Cascading Style Sheets

Styling can be added to HTML elements in 3 ways:

● Inline - using a style attribute in HTML elements

● Internal - using a <style> element in the HTML <head> section

● External - using one or more external CSS files

Page 39: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Why Using CSS? CSS is used to define styles for your web pages,

including the design, layout and variations in

display for different devices and screen sizes.

Page 40: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Css Syntax

Page 41: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Css Comments

p {

color: red;

/* This is a single-line comment */

text-align: center;

}

/* This is

a multi-line

comment */

Page 42: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Css Selectors

CSS selectors allow you to select and manipulate HTML elements.

CSS selectors are used to "find" (or select) HTML elements based on their id, class, type, attribute, and

more.

Page 43: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Element Selector

p {

text-align: center;

color: red;

}

Page 44: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

ID Selector

#ElementID {

text-align: center;

color: red;

}

Page 45: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Class Selector

.ElementClass {

text-align: center;

color: red;

}

Page 46: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

CSS3 Features !

- New CSS Selectors

- 2D Transform

- Animations

Page 47: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Not a Web Designer

Page 48: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Use Bootstrap

Page 49: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

JavaScript- Script Language

- Interpreted by Browser

- Orientée Objet

- DOM manipulation

- Dynamic UI

- Used in Servers (NodeJS)

Page 50: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

What JavaScript can do with DOM?

- Change an HTML Element

- Change an attribute of an HTML Element

- Change the CSS style of an HTML Element

- Remove an existing HTML element or its attributes

- Add new a HTML Element or a new attribute to an Element

- React to an event associated with an HTML Element

- Create a new event listener and associate with an HTML Element

Page 51: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Why JavaScript

- It's pretty easy to learn. Trust me!- Libraries! Javascript has libraries for everything. Literally. You can build

a complete mobile website in a day using jQuery mobile. - Speed: Javascript is fast. And client side. Reduces load on server.- Javascript can also be used to provide offline functionality.- JSON started with Javascript! So did XML!- Ajax: Every web developer knows and loves Ajax. No point to be made

on this.

Page 52: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Let’s Dive in

Page 53: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Dynamic Web

Page 54: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

WAMP/LAMP Stack

Page 55: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP
Page 56: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

PHP LanguagePHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP, NodeJS and JEE.

Page 57: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Hello world<!DOCTYPE html><html><body>

<?php

echo "My first PHP script!";

?>

</body></html>

Page 58: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

VariablesIn PHP, a variable starts with the $ sign, followed by the name of the variable:

<?php$txt = "Hello world!";$x = 5;$y = 10.5;?>

Page 59: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Let’s Hack

Page 60: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Let’s Hack

Page 61: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Database Story

Page 62: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Database Notations

Page 63: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

MySql

Page 64: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

PHP and Mysql !!

Page 65: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

mysql, mysqli and PDOConnectors

Page 66: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Connect Example<?php

$servername = "localhost";

$username = "username";

$password = "password";

// Create connection

$conn = new mysqli($servername, $username, $password);

// Check connection

if ($conn->connect_error) {

die("Connection failed: " . $conn->connect_error);

}

echo "Connected successfully";

?>

Page 67: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Fetch Data<?php

$servername = "localhost";

$username = "username";

$password = "password";

$dbname = "myDB";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection

if ($conn->connect_error) {

die("Connection failed: " . $conn->connect_error);

}

$sql = "SELECT id, firstname, lastname FROM MyGuests";

$result = $conn->query($sql);

if ($result->num_rows > 0) {

// output data of each row

while($row = $result->fetch_assoc()) {

echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

}

} else {

echo "0 results";

}

$conn->close();

?>

Page 68: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Insert Data<?php

$servername = "localhost";

$username = "username";

$password = "password";

$dbname = "myDB";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection

if ($conn->connect_error) {

die("Connection failed: " . $conn->connect_error);

}

$sql = "INSERT INTO MyGuests (firstname, lastname, email)

VALUES ('John', 'Doe', '[email protected]')";

if ($conn->query($sql) === TRUE) {

echo "New record created successfully";

} else {

echo "Error: " . $sql . "<br>" . $conn->error;

}

$conn->close();

?>

Page 69: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Update Data<?php

$servername = "localhost";

$username = "username";

$password = "password";

$dbname = "myDB";

// Create connection

$conn = mysqli_connect($servername, $username, $password, $dbname);

// Check connection

if (!$conn) {

die("Connection failed: " . mysqli_connect_error());

}

$sql = "UPDATE MyGuests SET lastname='Doe' WHERE id=2";

if (mysqli_query($conn, $sql)) {

echo "Record updated successfully";

} else {

echo "Error updating record: " . mysqli_error($conn);

}

mysqli_close($conn);

?>

Page 70: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Delete Data<?php

$servername = "localhost";

$username = "username";

$password = "password";

$dbname = "myDB";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection

if ($conn->connect_error) {

die("Connection failed: " . $conn->connect_error);

}

// sql to delete a record

$sql = "DELETE FROM MyGuests WHERE id=3";

if ($conn->query($sql) === TRUE) {

echo "Record deleted successfully";

} else {

echo "Error deleting record: " . $conn->error;

}

$conn->close();

?>

Page 71: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Q/A

Page 72: Les Basiques - Web  Développement HTML5, CSS3, JS et PHP

Thank You !!!