Documente Academic
Documente Profesional
Documente Cultură
WEB TECHNOLOGY
SEARCH ENGINE:A web search engine is a software system that is designed to search for
information on the World Wide Web. The search results are generally presented in a line of
results often referred to as search engine results pages (SERPs). The information may be a
specialist in web pages, images, information and other types of files. Some search engines
also mine data available in databases or open directories. Unlike web directories, which are
maintained only by human editors, search engines also maintain real-time information by
running an algorithm on a web crawler.
A search engine operates in the following order:
1. Web crawling
2. Indexing
3. Searching
Web search engines work by storing information about many web pages, which they
retrieve from the HTML markup of the pages. These pages are retrieved by a Web
crawler (sometimes also known as a spider) — an automated Web crawler which follows
every link on the site. The site owner can exclude specific pages by using robots.txt.
The search engine then analyzes the contents of each page to determine how it should
be indexed (for example, words can be extracted from the titles, page content, headings, or
special fields called meta tags). Data about web pages are stored in an index database for
use in later queries. A query from a user can be a single word. The index helps find
information relating to the query as quickly as possible. Some search engines, such
as Google, store all or part of the source page (referred to as a cache) as well as information
about the web pages, whereas others, such as AltaVista, store every word of every page
they find. This cached page always holds the actual search text since it is the one that was
actually indexed, so it can be very useful when the content of the current page has been
updated and the search terms are no longer in it. This problem might be considered a mild
form of linkrot, and Google's handling of it increasesusability by satisfying user
expectations that the search terms will be on the returned webpage. This satisfies
the principle of least astonishment, since the user normally expects that the search terms
will be on the returned pages. Increased search relevance makes these cached pages very
useful as they may contain data that may no longer be available elsewhere.
WEB PORTAL:A web portal is most often one specially-designed Web page at
a website which brings information together from diverse sources in a uniform way.
Usually, each information source gets its dedicated area on the page for displaying
information (a portlet); often, the user can configure which ones to display. Variants of
portals include Mashup (web application hybrid) and intranet"dashboards" for executives
and managers. The extent to which content is displayed in a "uniform way" may depend on
the intended user and the intended purpose, as well as the diversity of the content. Very
often design emphasis is on a certain "metaphor" for configuring and customizing the
presentation of the content and the chosen implementation framework and/or code
libraries. In addition, the role of the user in an organization may determine which content
can be added to the portal or deleted from the portal configuration.
A portal may use a search engine API to permit users to search intranet content as opposed
to extranet content by restricting which domains may be searched. Apart from this
common search engines feature, web portals may offer other services such as e-mail, news,
stock quotes, information from databases and even entertainment content. Portals provide
a way for enterprises and organizations to provide a consistent look and feel with access
control and procedures for multiple applications and databases, which otherwise would
have been different web entities at various URLs. The features available may be restricted
by whether access is by an authorized and authenticated user (employee,member) or an
anonymous site visitor.Examples of early public web portals
Are AOL, Excite, Netvibes, iGoogle, MSN, Naver, Indiatimes, Rediff, Sify and Yahoo!. See for
example, the "My Yahoo!" feature of Yahoo! which may have inspired such features as the
later Google "iGoogle" (soon to be discontinued.) The configurable side-panels of, for
example, the modern Opera browser and the option of "Speed Dial" pages by most
browsers continue to reflect the earlier "portal" metaphor. Web portals are sometimes
classified as horizontal or vertical. A horizontal portal is used as a platform to several
companies in the same economic sector or to the same type of manufacturers or
distributors.[1] A vertical portal (also known as a "vortal") is a specialized entry point to a
specific market or industry niche, subject area, or interest. Some vertical portals are known
as "vertical information portals" (VIPs). VIPs provide news, editorial content, digital
publications, and e-commerce capabilities. In contrast to traditional vertical portals, VIPs
also provide dynamic multimedia applications including social networking, video posting,
and blogging.
E-COMMERCE:Electronic commerce, commonly known as e-commerce or eCommerce,
is a type of industry where the buying and selling of products or services is conducted over
electronic systems such as the Internet and other computer networks. Electronic
commerce draws on technologies such as mobile commerce, electronic funds
transfer, supply chain management, Internet marketing, online transaction
processing, electronic data interchange (EDI), inventory management systems, and
automated data collection systems. Modern electronic commerce typically uses the World
Wide Web at least at one point in the transaction's life-cycle, although it may encompass a
wider range of technologies such as e-mail, mobile devices, social media, and telephones as
well.
Electronic commerce is generally considered to be the sales aspect of e-business. It also
consists of the exchange of data to facilitate the financing and payment aspects of business
transactions. This is an effective and efficient way of communicating within an organization
and one of the most effective and useful ways of conducting business.
E-commerce can be divided into:
DESCRIPTION:
HTML tags are keywords (tag names) surrounded by angle brackets like <html>
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is the end tag
The end tag is written like the start tag, with a forward slash before the tag name
Start and end tags are also called opening tags and closing tags
<tagname>content</tagname>
"HTML tags" and "HTML elements" are often used to describe the same thing.
But strictly speaking, an HTML element is everything between the start tag and the end tag,
including the tags:
HTML Element:
<p>This is a paragraph.</p>
HTML Page Structure
However, for learning HTML we recommend a text editor like Notepad (PC) or TextEdit
(Mac). We believe using a simple text editor is a good way to learn HTML.
Follow the 4 steps below to create your first web page with Notepad.
Step 1: Start Notepad
Start
All Programs
Accessories
Notepad
Step 2: Edit Your HTML with Notepad
When you save an HTML file, you can use either the .htm or the .html file extension. There
is no difference, it is entirely up to you.
DESCRIPTION:
HTML Headings
HTML Links
The filename and the size of the image are provided as attributes.
HTML Elements:An HTML element is everything from the start tag to the end tag:
Start tag * Element content End tag *
<p> This is a paragraph </p>
<br>
* The start tag is often called the opening tag. The end tag is often called the closing tag.
HTML Element Syntax
Most HTML elements can be nested (can contain other HTML elements).
<body>
<p>This is my first paragraph.</p>
</body>
</html>
<body>
<p>This is my first paragraph.</p>
</body>
</html>
Some HTML elements might display correctly even if you forget the end tag:
<p>This is a paragraph
<p>This is a paragraph
The example above works in most browsers, because the closing tag is considered optional.
Never rely on this. Many HTML elements will produce unexpected results and/or errors if
yOu forget the end tag .
Empty HTML Elements
<br> is an empty element without a closing tag (the <br> tag defines a line break).
In XHTML, all elements must be closed. Adding a slash inside the start tag, like <br />, is
the proper way of closing empty elements in XHTML (and XML).
HTML Attributes
HTML links are defined with the <a> tag. The link address is specified in the href attribute:
Example
<a href="http://www.w3schools.com">This is a link</a>
HTML Headings
Comments can be inserted into the HTML code to make it more readable and
understandable. Comments are ignored by the browser and are not displayed.
HTML uses tags like <b> and <i> for formatting output, like bold or italic text.
These HTML tags are called formatting tags (look at the bottom of this page for a complete
rOften <strong> renders as <b>, and <em> renders as <i>.
<strong> or <em> means that you want the text to be rendered in a way that the user
understands as "important". Today, all major browsers render strong as bold and em as
italics. However, if a browser one day wants to make a text highlighted with the strong
feature, it might be cursive for example and not bold.
HTML Hyperlinks (Links)
A hyperlink (or link) is a word, group of words, or image that you can click on to jump to
another document.
When you move the cursor over a link in a Web page, the arrow will turn into a little hand.
The most important attribute of the <a> element is the href attribute, which indicates the
link's destination.
The following tags can be added to the head section: <title>, <style>, <meta>, <link>,
<script>, <noscript>, and <base>.
The HTML <title> Element
<body>
The content of the document......
</body>
</html>
The <base> tag specifies the base URL/target for all relative URLs in a page:
<head>
<base href="http://www.w3schools.com/images/" target="_blank">
</head>
The <link> tag defines the relationship between a document and an external resource.
The <style> tag is used to define style information for an HTML document.
Inside the <style> element you specify how HTML elements should render in a browser:
<head>
<style type="text/css">
body {background-color:yellow;}
p {color:blue;}
</style>
</head>
The <meta> tag provides metadata about the HTML document. Metadata will not be
displayed on the page, but will be machine parsable.
Meta elements are typically used to specify page description, keywords, author of the
document, last modified, and other metadata.
The metadata can be used by browsers (how to display content or reload page), search
engines (keywords), or other web services.
<base> Defines a default address or a default target for all links on a page
DESCRIPTION:
A CSS rule has two main parts: a selector, and one or more declarations:
The property is the style attribute you want to change. Each property has a value.
CSS Example
A CSS declaration always ends with a semicolon, and declaration groups are surrounded by
curly brackets:
p {color:red;text-align:center;}
To make the CSS more readable, you can put one declaration on each line, like this:
Example
p
{
color:red;
text-align:center;
}
CSS Comments
Comments are used to explain your code, and may help you when you edit the source code
at a later date. Comments are ignored by browsers.
A CSS comment begins with "/*", and ends with "*/", like this:
/*This is a comment*/
p
{
text-align:center;
/*This is another comment*/
color:black;
font-family:arial;
}
The id and class Selectors
In addition to setting a style for a HTML element, CSS allows you to specify your own
selectors called "id" and "class".
The id Selector
The id selector uses the id attribute of the HTML element, and is defined with a "#".
The style rule below will be applied to the element with id="para1":
Example
#para1
{
text-align:center;
color:red;
}
The class Selector
The class selector is used to specify a style for a group of elements. Unlike the id selector,
the class selector is most often used on several elements.
This allows you to set a particular style for many HTML elements with the same class.
The class selector uses the HTML class attribute, and is defined with a "."
In the example below, all HTML elements with class="center" will be center-aligned:
Example
.center {text-align:center;}
You can also specify that only specific HTML elements should be affected by a class.
An external style sheet is ideal when the style is applied to many pages. With an external
style sheet, you can change the look of an entire Web site by changing one file. Each page
must link to the style sheet using the <link> tag. The <link> tag goes inside the head
section:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
An external style sheet can be written in any text editor. The file should not contain any
html tags. Your style sheet should be saved with a .css extension. An example of a style
sheet file is shown below:
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
Internal Style Sheet
An internal style sheet should be used when a single document has a unique style. You
define internal styles in the head section of an HTML page, by using the <style> tag, like
this:
<head>
<style>
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
</style>
</head>
Inline Styles
An inline style loses many of the advantages of style sheets by mixing content with
presentation. Use this method sparingly!
To use inline styles you use the style attribute in the relevant tag. The style attribute can
contain any CSS property. The example shows how to change the color and the left margin
of a paragraph:
If some properties have been set for the same selector in different style sheets, the values
will be inherited from the more specific style sheet.
For example, an external style sheet has these properties for the h3 selector:
h3
{
color:red;
text-align:left;
font-size:8pt;
}
And an internal style sheet has these properties for the h3 selector:
h3
{
text-align:right;
font-size:20pt;
}
If the page with the internal style sheet also links to the external style sheet the properties
for h3 will be:
color:red;
text-align:right;
font-size:20pt;
The color is inherited from the external style sheet and the text-alignment and the font-size
is replaced by the internal style sheet.
Tip: Even multiple external style sheets can be referenced inside a single HTML document.
Cascading order
What style will be used when there is more than one style specified for an HTML element?
Generally speaking we can say that all the styles will "cascade" into a new "virtual" style
sheet by the following rules, where number four has the highest priority:
1. Browser default
2. External style sheet
3. Internal style sheet (in the head section)
4. Inline style (inside an HTML element)
So, an inline style (inside an HTML element) has the highest priority, which means that it
will override a style defined inside the <head> tag, or in an external style sheet, or in a
browser (a default value).
DESCRIPTION:
JavaScript is a Scripting Language
Example
x=document.getElementById("demo") //Find the element
x.innerHTML="Hello JavaScript"; //Change the content
JavaScript: Changing HTML Styles
Example
x=document.getElementById("demo") //Find the element
x.style.color="#ff0000"; //Change the style
JavaScript: Validate Input
JavaScripts can be put in the <body> and in the <head> section of an HTML page.
The <script> and </script> tells where the JavaScript starts and ends.
The lines between the <script> and </script> contain the JavaScript:
<script>
alert("My First JavaScript");
</script>
JavaScript in <body>
In this example, JavaScript writes into the HTML <body> while the page loads:
Example
<!DOCTYPE html>
<html>
<body>
.
.
<script>
document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph</p>");
</script>
.
.
</body>
</html>
A JavaScript Function in <head>
In this example, a JavaScript function is placed in the <head> section of an HTML page.
Example
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
document.getElementById("demo").innerHTML="My First JavaScript Function";
}
</script>
</head>
<body>
</body>
</html>
External JavaScripts
Scripts can also be placed in external files. External files often contain code to be used by
several different web pages.
To use an external script, point to the .js file in the "src" attribute of the <script> tag:
Example
<!DOCTYPE html>
<html>
<body>
<script src="myScript.js"></script>
</body>
</html>
Writing to The Document Output
The example below writes a <p> element directly into the HTML document output:
Example
<!DOCTYPE html>
<html>
<body>
<script>
document.write("<p>My First JavaScript</p>");
</script>
</body>
</html>
JavaScript Statements
This JavaScript statement tells the browser to write "Hello Dolly" inside an HTML element
with id="demo":
document.getElementById("demo").innerHTML="Hello Dolly";
JavaScript Comments
Comments can be added to explain the JavaScript, or to make the code more readable.
The following example uses single line comments to explain the code:
Example
// Write to a heading:
document.getElementById("myH1").innerHTML="Welcome to my Homepage";
// Write to a paragraph:
document.getElementById("myP").innerHTML="This is my first paragraph.";
Example
var x=5;
var y=6;
var z=x+y;
JavaScript Data Types
JavaScript variables can also hold other types of data, like text values (person="John Doe").
There are many types of JavaScript variables, but for now, just think of numbers and
strings.
When you assign a text value to a variable, put double or single quotes around the value.
When you assign a numeric value to a variable, do not put quotes around the value. If you
put quotes around a numeric value, it will be treated as text.
DESCRIPTION:
PHP is a server scripting language, and is a powerful tool for making dynamic and
interactive Web pages quickly.
PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
With PHP you are not limited to output HTML. You can output images, PDF files, and even
Flash movies. You can also output any text, such as XHTML and XML.
<?php
echo "Hello World!";
?>
</body>
</html>
A comment in PHP code is a line that is not read/executed as part of the program. Its only
purpose is to be read by someone who is editing the code!
To let others understand what you are doing - Comments let other programmers
understand what you were doing in each step (if you work in a group)
To remind yourself what you did - Most programmers have experienced coming
back to their own work a year or two later and having to re-figure out what they did.
Comments can remind you of what you were thinking when you wrote the code
Example
<!DOCTYPE html>
<html>
<body>
<?php
// This is a single line comment
/*
This is a multiple lines comment block
that spans over more than
one line
*/
?>
</body>
</html>
PHP Variables
As with algebra, PHP variables can be used to hold values (x=5) or expressions (z=x+y).
A variable can have a short name (like x and y) or a more descriptive name (age, carname,
total_volume).
A variable starts with the $ sign, followed by the name of the variable
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-
9, and _ )
Variable names are case sensitive ($y and $Y are two different variables)
Example
<?php
$txt="Hello world!";
$x=5;
$y=10.5;
?>
PHP Variables Scope
The scope of a variable is the part of the script where the variable can be referenced/used.
local
global
static
The PHP echo Statement
echo is a language construct, and can be used with or without parentheses: echo or
echo().
Display Strings
The following example shows how to display different strings with the echo
command (also notice that the strings can contain HTML markup):
Example
<?php
echo "<h2>PHP is fun!</h2>";
echo "Hello world!<br>";
echo "I'm about to learn PHP!<br>";
echo "This", " string", " was", " made", " with multiple parameters.";
?>
The PHP print Statement
print is also a language construct, and can be used with or without parentheses:
print or print().
Display Strings
The following example shows how to display different strings with the print
command (also notice that the strings can contain HTML markup):
Example
<?php
print "<h2>PHP is fun!</h2>";
print "Hello world!<br>";
print "I'm about to learn PHP!";
?>
PHP Strings
A string can be any text inside quotes. You can use single or double quotes:
Example
<?php
$x = "Hello world!";
echo $x;
echo "<br>";
$x = 'Hello world!';
echo $x;
?>
PHP Integers
In the following example we will test different numbers. The PHP var_dump() function
returns the data type and value of variables:
Example
<?php
$x = 5985;
var_dump($x);
echo "<br>";
$x = -345; // negative number
var_dump($x);
echo "<br>";
$x = 0x8C; // hexadecimal number
var_dump($x);
echo "<br>";
$x = 047; // octal number
var_dump($x);
?>
PHP Floating Point Numbers
A floating point number is a number with a decimal point or a number in exponential form.
In the following example we will test different numbers. The PHP var_dump() function
returns the data type and value of variables:
Example
<?php
$x = 10.365;
var_dump($x);
echo "<br>";
$x = 2.4e3;
var_dump($x);
echo "<br>";
$x = 8E-5;
var_dump($x);
?>
PHP Booleans
Booleans are often used in conditional testing. You will learn more about conditional
testing in a later chapter of this tutorial.
PHP Arrays
In the following example we create an array, and then use the PHP var_dump() function to
return the data type and value of the array:
Example
<?php
$cars=array("Volvo","BMW","Toyota");
var_dump($cars);
?>
PHP Conditional Statements
Very often when you write code, you want to perform different actions for different
decisions. You can use conditional statements in your code to do this.
The if statement is used to execute some code only if a specified condition is true.
Syntax
if (condition)
{
code to be executed if condition is true;
}
The example below will output "Have a good day!" if the current time (HOUR) is less than
20:
Example
<?php
$t=date("H");
if ($t<"20")
{
echo "Have a good day!";
}
?>
Use the if....else statement to execute some code if a condition is true and another code if
the condition is false.
Syntax
if (condition)
{
code to be executed if condition is true;
}
else
{
code to be executed if condition is false;
}
The example below will output "Have a good day!" if the current time is less than 20, and
"Have a good night!" otherwise:
Example
<?php
$t=date("H");
if ($t<"20")
{
echo "Have a good day!";
}
else
{
echo "Have a good night!";
}
?>
Syntax
if (condition)
{
code to be executed if condition is true;
}
elseif (condition)
{
code to be executed if condition is true;
}
else
{
code to be executed if condition is false;
}
The example below will output "Have a good morning!" if the current time is less than 10,
and "Have a good day!" if the current time is less than 20. Otherwise it will output "Have a
good night!":
Example
<?php
$t=date("H");
if ($t<"10")
{
echo "Have a good morning!";
}
elseif ($t<"20")
{
echo "Have a good day!";
}
else
{
echo "Have a good night!";
}
?>
Use the switch statement to select one of many blocks of code to be executed.
Syntax
switch (n)
{
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
case label3:
code to be executed if n=label3;
break;
...
default:
code to be executed if n is different from all labels;
}
This is how it works: First we have a single expression n (most often a variable), that is
evaluated once. The value of the expression is then compared with the values for each case
in the structure. If there is a match, the block of code associated with that case is executed.
Use break to prevent the code from running into the next case automatically.
Thedefault statement is used if no match is found.
Example
<?php
$favcolor="red";
switch ($favcolor)
{
case "red":
echo "Your favorite color is red!";
break;
case "blue":
echo "Your favorite color is blue!";
break;
case "green":
echo "Your favorite color is green!";
break;
default:
echo "Your favorite color is neither red, blue, or green!";
}
?>
PHP Loops
Often when you write code, you want the same block of code to run over and over again in
a row. Instead of adding several almost equal code-lines in a script, we can use loops to
perform a task like this.
while - loops through a block of code as long as the specified condition is true
do...while - loops through a block of code once, and then repeats the loop as long as
the specified condition is true
for - loops through a block of code a specified number of times
foreach - loops through a block of code for each element in an array
The while loop executes a block of code as long as the specified condition is true.
Syntax
while (condition is true)
{
code to be executed;
}
The example below first sets a variable $x to 1 ($x=1;). Then, the while loop will continue to
run as long as $x is less than, or equal to 5. $x will increase by 1 each time the loop runs
($x++;):
Example
<?php
$x=1;
while($x<=5)
{
echo "The number is: $x <br>";
$x++;
}
?>
Syntax
do
{
code to be executed;
}
while (condition is true);
The example below first sets a variable $x to 1 ($x=1;). Then, the do while loop will write
some output, and then increment the variable $x with 1. Then the condition is checked (is
$x less than, or equal to 5?), and the loop will continue to run as long as $x is less than, or
equal to 5:
Example
<?php
$x=1;
do
{
echo "The number is: $x <br>";
$x++;
}
while ($x<=5)
?>
The for loop is used when you know in advance how many times the script should run.
Syntax
for (init counter; test counter; increment counter)
{
code to be executed;
}
Parameters:
Example
<?php
for ($x=0; $x<=10; $x++)
{
echo "The number is: $x <br>";
}
?>