html & php

Post on 30-Dec-2015

25 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

HTML & PHP. What’s the difference?. HTML. Hypertext Markup Language Key Word is “Markup” HTML is the code that makes the “screen” All web pages are made of HTML HTML is not a programming language Files end in .html. HTML required keywords. - PowerPoint PPT Presentation

TRANSCRIPT

HTML & PHP

What’s the difference?

HTML

Hypertext Markup Language Key Word is “Markup” HTML is the code that makes the “screen” All web pages are made of HTML HTML is not a programming language Files end in .html

HTML required keywords

<html></html> <head></head> <title></title> <body></body>

HTML example – Hello World

<html>

<head>

<title>Here is the Title</title>

</head>

<body>

Hello World!

</body>

</html>

• Blank lines and spaces are ignored

HTML common keywords

<div></div> <table></table> <p></p> <form></form> <br /> <img /> <a></a>

Subfiles to Tables

<table> …subfile data … </table>

_ keyboard $12.95

_ Mouse $19.95

<table>

<tbody>

<tr><td>_</td><td>keyboard</td><td>$12.95</td></tr>

<tr><td>_</td><td>Mouse</td><td>$19.95</td></tr>

</tbody>

</table>

HTML advanced example<html>

<head>

<title>Advanced Example</title>

</head>

<body>

<p>This text is in a paragraph</p>

This text is not inside a paragraph.

Neither is this.

<p>But this text is</p>

<div>And this text is in a Div tag</div>

</body>

</html>

PHP

Pre-Hypertext Processor The programming language (logic) Non-Compiled Stand Alone or imbedded in HTML All PHP files must end in .php

PHP and RPG

Both are easy to use for business logic Both are procedural languages Both can access iseries objects Both run on the iseries Both benefit from short acronyms

PHP not RPG

Free Format (RPG 2 / 3) Non-Compiled Dynamically Typed Variables $var Tags <?php ?> C Style end lines “;”

PHP example<?php

echo “Hello World”;

?>

<?php

$variable = “Hello World”;

echo $variable;

?>

PHP + HTML example<html>

<head>

<title>PHP + HTML example</title>

</head>

<body>

<?php $variable = “Hello World!!!” ?>

<p><?php echo $variable ?></p>

<?php $variable = “Part 2” ?>

<p><?php echo $variable ?></p>

</body>

</html>

PHP conditionals

If($x == 2){ echo “x is equal to 2”; } while($x < 3){ echo $x; $x++; } foreach($array as $x){ echo $x; } do{ echo $x; $x++; } while($x <= 10); for… switch…

Try it out!

Go to your page and try creating and changing variables.

Change a variable from a string to an integer: $var = “Hello World”; echo $var; $var = 501; echo $var;

Test Paragraphs and line breaks

top related