To generate HTML Pages by PHP, we need to echo certain HTML tags, like <head>,<html>, external javascripts, css, <meta> tags blah blah blah…. it’s boring to print these tags each time you create a HTML page just to display a short message or short body. So I’ve created a template called html.php, you can include this source in your php page and call html_head() to generate the basic HTML tags!
Download Links
Latest Version | Old Version | Mirror link
Why use it?
Wondering why use this generator? Just include the html.php in your source by calling
require_once('html.php');
Then call
html_head();
Bingo! the function html_head automatically generate following HTML tags for you!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <LINK REL="SHORTCUT ICON" HREF="http://i46.tinypic.com/111up8o.jpg"> <meta name="description" content="Generated HTML by PHP" /> <meta name="keywords" content="Generated HTML by PHP" /> <title>Generated HTML</title><style type="text/css">body{font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#333;}</style>
Cool! Of course, you can pass optional parameters in html_head() and customize the generated HTML.
Documentations
Pass optional parameters in html_head() function. The function has a definition like:
html_head($title = "Generated HTML", $css_array = "", $js_array = "", $start_body=false)
Explanation:
$title: Document Title
$css_array: Array of External CSS files (.css) to be included
$js_array: Array of External javascript files (.js) to be included
$start_body: If passed as true, it will print </head><body>, otherwise not.
You see, all parameters are optional. For Example, if you need to include myjs.js you can call html_head like this:
html_head("My New HTML File", "", array('myjs.js'));
Other Functions:
html_foot: prints </body></head>
html_error: Prints an Error/OK message. See source for more details.