View Single Post
Old 09-04-2007   #2 (permalink)
Jolt
Registered User
 
Join Date: Aug 2004
Posts: 119

Anytime you are displaying content in a browser window you should have html tags.

While it's true that
PHP Code:
<?php
print 'Hello world';
?>
or
PHP Code:
<?php
echo 'Hello world';
?>
will spit out text to a browser, for proper web formatting you still need all the standard html tags. So to spit the same php out in a properly formatted web page you need the following:
PHP Code:
<?php
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Your Page</title>
</head>
<body>
Hello world
</body>
</html>'
;
?>
Jolt is offline