Static: contains web pages with fixed content coded in HTML and stored on a web server. It does not change, it stays the same, or "static" for every viewer of the site. A static website does not require web programming or database design.
Dynamic: A Dynamic Website (also referred to as a database-driven site) requires web programming and database design. A dynamic website contains information and content that changes, depending on factors.
Websites: Websites are one-way informational feeds, they do not allow viewers to interact or communicate back to the site.
Web-Applications: Web applications are websites with functionality and interactive elements. Gmail, Facebook, YouTube, Twitter, etc. are all web apps that are dynamic, and built for user engagement.
Hosting: Web hosting is the place where all the files of your website live.
Domain: Domain name is the address of your website that people type in the browser’s URL bar to visit your website.
Both GET and POST method is used to transfer data from client to server in HTTP protocol.
POST: The data sent to the server with POST is stored in the request body of the HTTP request:
GET: GET method is used to appends form data to the URL in name or value pair.
HTML document is a plain text file that has been encoded using Hypertext Markup Language
(HTML) so that it appears nicely formatted in a Web browser.
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
<!DOCTYPE html>
define the version of HTML.<html>
root element of HTML page.<head>
may contains stylesheets & meta information of HTML page.<title>
define page title (which is shown in the browser's title bar).<body>
body is a container for all the visible contents, such as headings, paragraphs, images, videos, hyperlinks, tables, lists, forms etc.<h1>
heading tag.<p>
paragraph tag.An element in HTML usually consist of a start tag <tag name>, close tag </tag name> and content inserted between them. Technically, an element is a collection of start tag, attributes, end tag, content between them.
Note: Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag!Element Examples:
<h1>My Heading</h1> <p>My Paragraph.</p>
HTML tags are like keywords which defines that how web browser will format and display the content.
Tag Examples:
<h1> <p>
Attributes are special words which provide additional information about the elements. attribute should always be applied with opening/start tag. attribute should be applied with its name and value. we can use multiple attribute in single element with space between two attributes.
Attribute Examples:
<input type="text" /> <marquee direction="left" bgcolor="red">My Marquee.</marquee>
The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data. <meta> tags always go inside the <head> element, and are typically used to specify language, character set, page description, keywords, author of the document, and viewport settings. Metadata will not be displayed on the page, but browser read that. Metadata is also SEO ranking fector.
Meta Tag Examples:
<head> <meta charset="UTF-8"> <meta name="description" content="Free Web tutorials"> <meta name="keywords" content="HTML, CSS, JavaScript"> <meta name="author" content="John Doe"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head>
HTML has the ability to let events trigger actions in a browser, like starting a JavaScript when a user clicks on an element.
HTML have many types of event attributes:
Event Attribute Examples:
<body onresize="alert("User resize the screen size");"> <input oninput="myFunction()"> <input type="text" onkeydown="keyDownFunction()"> <input ondblclick="alert("User Perform Double Click Action");"> <input type="text" oncopy="alert("You text has been copied!")" value="Try to copy this text">
When a browser requests a service from a web server, an error might occur, and the server might return an error code like "404 Not Found". But these messages are something called HTTP status messages. In fact, the server always returns a message for every request. The most common message is 200 OK.
Tag | Description |
---|---|
< !DOCTYPE > | Define document type or version of HTML |
< html > | Define html document |
< head > | Contains metadata/information for the document |
< title > | Defines a title for the document |
< body > | |
< h1 to h6 > | Define headings 1 to 6 |
< p > | Define a paragraph |
< br > | Define single break line |
< hr > | Define horizontal line |
< !-- ... -- > | Define Comment |
CSS stands for Cascading Style Sheets.
CSS describes how HTML elements are to be displayed.
A CSS rule consists of a selector and a declaration block:
Selector may be HTML tag, id & class
Declaration Block in curly braces contains one or more declarations separated by semicolons.
Declaration includes a CSS property name and a value, separated by a colon.
There are 3 ways to attach CSS with HTML.
<p style="color:red;">
<style>
element, inside the <head>
section.
<head> <style> p { color:red; } /<style> </head>
<link>
tag inside <head>
tag. External CSS file save with .css extension.
<head> <link href="/style.css"> </head>
A CSS comment starts with /*
and ends with */
Padding: properties are used to generate space around an element's content, inside of any defined borders.
Margin: properties are used to create space around elements, outside of any defined borders.
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language. While it is most well-known as the scripting language for Web pages. JavaScript is case-sensitive language.
JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.
There are many useful Javascript frameworks and libraries available:
According to the latest ECMAScript release, following are the data types supported in Javascript:
Primitive:
Non-Primitive:
Both JavaScript and Jscript designed for to make web page More dynamic.
JavaScript: JavaScript is a scripting language developed by Netscape Communications designed for developing client and server Internet applications.
JScript: JScript is owned by Microsoft and used in one of the most popular web browser Microsoft’s Internet Explorer. JScript can also be called “Microsoft’s JavaScript”.
Pros | Cons |
---|---|
Fast to the end user | Security Flows on user end |
Simplicity | More and better Competitor |
Versatility | File Download [JavaScript file is download on client machine so anyone can read the code and reuse it.] |
There are 3 ways to attach javascript with web pages or HTML Documents
events
attributes.
<input type="button" onclick="alert("This alert call by inline Java Script");">
<head>
or <body>
tag using <script>
tag.
// use javascript in head section <head> <script> function myFunction() { alert("This alert call by internal Java Script"); } /<script> </head> // use javascript in body tag before closing body section <body> <p>...</p> <h2>...</h2> <script> function myFunction() { alert("This alert call by internal Java Script"); } /<script> </body>
<link>
tag inside <head>
section. External JavaScript file save with .js extension.
<head> <link href="/script.js"> </head>
A computer program is a list of "instructions" to be "executed" by a computer.
In a programming language, these programming instructions are called "statements".
JavaScript statements are composed of:
Values, Operators, Expressions, Keywords, and Comments.
The statements are executed, one by one, in the same order as they are written.
JavaScript syntax is the set of rules, how JavaScript programs are constructed.
var a, b, c; // Declare Variables a = 5; b = 6; // Assign Values c = a + b; // Compute Values document.write(c); // output on HTML document document.log(c); // output on browser console tab
JavaScript keywords are used to identify actions to be performed.
Example:
"var" keyword is identifiy to perform declaration of variable.
"function" keyword is identify to perform function statement.
In a programming language, variables are used to store data values.
An operator is a character that represents an action.
in javascript have many types of operators:
Operators | Symbols |
---|---|
Arithmetic Operators | +, -, *, /, %, ++, -- |
Comparison Operators | ==, !=, >, <, <=, >=, === |
Arithmetic Operators | +, -, *, /, %, ++, -- |
Logical Operators | &&, ||, ! |
Bitwise Operators | &, |, ^, ~, <<, >>, >>> |
Conditional Operator | ? : (if condition is true ? then value is X : otherwise value is Y) |
Assignment Operators | =, +=, -=, *=, /=, %= |
An expression is a combination of values, variables, and operators, which computes to a value.
Single Line Comment: denoted by //
Multiline Comment: start with /*
and end with */
Example:
'use strict'; var str = "Hello World"; document.write(str);
Example: var a;
Example: var a = null;
var text = '42px';
var integer = parseInt(text, 10);
// returns 42
var text = '42.35px';
var integer = parseInt(text);
// returns 42.35
Number('123'); // returns 123
Number('12.3'); // returns 12.3
Number('42px'); // returns NaN
var num = 15;
var n = num.toString();
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Some tools required for installation of PHP.
PHP, Apache, MySQL all are available in XAMPP or WAMP server.
Apache is an open-source and free web server software. The official name is Apache HTTP Server. Apache is a cross-platform software, therefore it works on both Unix and Windows servers. It allows website owners to serve content on the web — hence the name “web server.” It’s one of the oldest and most reliable web servers, with the first version released more than 20 years ago, in 1995.
we call Apache a web server, it is not a physical server, but rather a software that runs on a server. Its job is to establish a connection between a server and the browsers of website visitors.
WAMP: Windows, Apache, MySQL, PHP
XAMPP: Cross-Platform, Apache, MySQL, PHP and Perl
Recommended Use: <? php ?>
<body> <ul> <?php for($i=1;$i<=5;$i++){ ?> <li> Menu Item <?php echo $i; ?> </li> <?php } ?> <ul> </body>output:
Menu Item 1 Menu Item 2 Menu Item 3 Menu Item 4 Menu Item 5
Short Tag: <?= ?>
If you want to shorten your code as much as possible, you can go for the short_tags option. This will save you from typing <?php at the beginning of the code, shortening it to just <?. In order to enable this, you should update the php.ini file and turn the "short_tags" setting from "Off" to "On"
<body> <p>Hello, today is <?= date('Y/m/d H:i:s'); ?>.</p> </body>output:
2012/03/06 17:33:07
Rules for PHP variables:
$
sign, followed by the name of the variablea,b,c,...,
or the underscore _
character0,1,2,...
$name
and $Name
are two different variables)With PHP, there are two basic ways to get output: echo
and print
.
<php $txt1 = "Learn Web Programming"; $txt2 = "thenanosoft.github.io/WD-6B"; $x = 5; $y = 4; echo "<h2>" . $txt1 . "</h2>"; echo "Study PHP at " . $txt2 . "<br>"; echo $x + $y; ?>echo Example:
<php $txt1 = "Learn Web Programming"; $txt2 = "thenanosoft.github.io/WD-6B"; $x = 5; $y = 4; print "<h2>" . $txt1 . "</h2>"; print "Study PHP at " . $txt2 . "<br>"; print $x + $y; ?>
Function | Description |
---|---|
strlen() | Return the Length of a String
<?php
|
str_word_count() | Count Words in a String
<?php
|
strrev() | Reverse a String
<?php
|
strpos() | Search For a Text Within a String
<?php
|
str_replace() | Replace Text Within a String
<?php
|
WordPress (WordPress.org) is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database.
WordPress users may install and switch among different themes. Themes allow users to change the look and functionality of a WordPress website without altering the core code or site content. Every WordPress website requires at least one theme to be present.
WordPress plugin architecture allows users to extend the features and functionality of a website or blog. As of January 2021, WordPress.org has 58,164 plugins available
WordPress.org you host your own site.
WordPress.com that takes care of all of this for you (easier to start, less freedom). And that’s the major difference.
MySQL is the most popular database system used with PHP. The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows. Databases are useful for storing information.
MySQL is a database system used on the web.
MySQL is a database system that runs on a server.
MySQL is ideal for both small and large applications.
MySQL is very fast, reliable, and easy to use.
MySQL uses standard SQL.
MySQL compiles on a number of platforms.
MySQL is free to download and use.
MySQL is developed, distributed, and supported by Oracle Corporation.
MySQL is named after co-founder Monty Widenius's daughter. My
PHP 5 and later can work with a MySQL database using:
mysqli_connect()
mysqli_connect_errorno()
mysqli_connect_error()
mysqli_close()
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $databasename);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
<?php
$conn = mysqli_connect($servername, $username, $password, $databasename);
// Check connection
if (mysqli_connect_errno()) {
die("Connection Field");
}
else {
echo("Connection Established");
}
?>
<?php
mysqli_close($conn);
?>
<?php
// Perform query
$query = "SELECT * FROM Persons";
$result = mysqli_query($con, $query);
if (!($result)) {
die("database query failed.");
}
else {
echo("database query passed.");
}
?>
<?php
<body>
while($row = mysqli_fetch_row($result)){
var_dump($row);
echo “<hr />;
}
</body>
?>
<?php
mysqli_free_result($result);
?>
mysqli_query($conn, $query)
mysql_fetch_row($result);
mysqli_fetch_assoc($result)
mysqli_fetch_assoc($result, $resulttype)
$result
is mysql query & connection "result", and $resulttype
Specifies what type of array that should be produced.