Upload
hamdi-hmidi
View
471
Download
5
Embed Size (px)
Citation preview
<Hmidi Hamdi>
Hmidi HamdiWeb & Mobile DeveloperSoftware Engineering @ ISSATSoFounder & Member @ IGC JSA @ JCertif Tunisia
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)
IGC Projects2015-2016
Basic Notations
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.
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.
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).
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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
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
Static Web HTML5, CSS3 and JavaScript
Static Web
OverviewHTML • Hypertext Markup Language • Structure of Page JavaScript • Interactivity with User • Dynamic Updates in a Web Page
CSS • Cascading Style Sheets • Presentation/Styling
Hello World ! <!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
HTML ElementsHTML elements are written with a start tag, with an end tag, with the content in between:
<tagname>content</tagname>
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>
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>
HTML ParagraphsHTML paragraphs are defined with the <p> tag:
<p>This is a paragraph.</p><p>This is another paragraph.</p>
HTML LinksHTML links are defined with the <a> tag:
<a href="http://www.w3schools.com">
This is a link
</a>
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">
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
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>
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
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.
Css Syntax
Css Comments
p {
color: red;
/* This is a single-line comment */
text-align: center;
}
/* This is
a multi-line
comment */
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.
Element Selector
p {
text-align: center;
color: red;
}
ID Selector
#ElementID {
text-align: center;
color: red;
}
Class Selector
.ElementClass {
text-align: center;
color: red;
}
CSS3 Features !
- New CSS Selectors
- 2D Transform
- Animations
Not a Web Designer
Use Bootstrap
JavaScript- Script Language
- Interpreted by Browser
- Orientée Objet
- DOM manipulation
- Dynamic UI
- Used in Servers (NodeJS)
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
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.
Let’s Dive in
Dynamic Web
WAMP/LAMP Stack
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.
Hello world<!DOCTYPE html><html><body>
<?php
echo "My first PHP script!";
?>
</body></html>
VariablesIn PHP, a variable starts with the $ sign, followed by the name of the variable:
<?php$txt = "Hello world!";$x = 5;$y = 10.5;?>
Let’s Hack
Let’s Hack
Database Story
Database Notations
MySql
PHP and Mysql !!
mysql, mysqli and PDOConnectors
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";
?>
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();
?>
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();
?>
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);
?>
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();
?>
Q/A
Thank You !!!