This page provides an explanation about how to actually type out your code, with examples given in HTML and PHP. Of course, the idea translates well to almost any other programming or markup language. First you close an element, then you fill it's contents.
HTML
If I want this:
Then this is how I actually type out the code:
<html>
<html></html>
<html>↵
↵
</html>
<html>
<head>
</html>
<html>
<head></head>
</html>
<html>
<head>↵
↵
</head>
</html>
<html>
<head>
</head>
<body></body>
</html>
<html>
<head>
</head>
<body>↵
↵
</body>
</html>
<html>
<head>
<meta />
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="" content="" />
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title></title>
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My Page</title>
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My Page</title>
</head>
<body>
<h1></h1>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My Page</title>
</head>
<body>
<h1>My Page</h1>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My Page</title>
</head>
<body>
<h1>My Page</h1>
<p></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My Page</title>
</head>
<body>
<h1>My Page</h1>
<p>Welcome to my page!</p>
</body>
</html>
PHP
If I want this:
Then this is how I actually type out the code:
<?php
<?php ?>
<?php↵
↵
?>
<?php
if ()
?>
<?php
if () {
}
?>
<?php
if () {
}else{
}
?>
<?php
if ( isset() ) {
}else{
}
?>
<?php
if ( isset($_POST[]) ) {
}else{
}
?>
<?php
if ( isset($_POST[""]) ) {
}else{
}
?>
<?php
if ( isset($_POST["name"]) ) {
}else{
}
?>
<?php
if ( isset($_POST["name"]) ) {
echo "";
}else{
}
?>
<?php
if ( isset($_POST["name"]) ) {
echo "";
}else{
echo "";
}
?>
<?php
if ( isset($_POST["name"]) ) {
echo "Nice name!";
}else{
echo "";
}
?>
<?php
if ( isset($_POST["name"]) ) {
echo "Nice name!";
}else{
echo "You forgot your name!";
}
?>
Date Published: 2011-02-21