Last night I decided to see if I could automate the majority of the work for creating web pages like creating the head remembering to close the head then start the body ... Remmebering back to my C++ classes with constructors and destructors I attempted to create a class in php (I stumbled upon classes in php when I was doing other stuff) following is my php Page class which takes some of the work out of making a page.
class Page
 private $buffer="";
 private $finnished_head=false;
 public $wait=false;
 private $javascript_functions=array();
 private $scripting=false;

 public function __construct($title="Web Page",$wait=false)
  $this->buffer="<!DOCTYPE html>\n<html>\n<head>\n<meta charset='utf-8'>\n<title>".$title."</title>\n";

 public function write()
 {print $this->buffer;

 public function start_body($body_options="")
  {$this->buffer.="</head>\n<body ".$body_options.">\n";

 public function append($text)

 public function __destruct()

 private function start_scripting()

 private function stop_scripting()

 public function f($name,$code,$args="")
 {if($code!="" && $code != null)
   {print "Usage error: You tryed over writting a previous declared javascript function";
    $this->buffer.="function ".$name."(".$args.")\n{".$code."\n}\n";

A quick example of how to use it.
include "Page.php";
$mypage=new Page();
<input name='test' type='text'>
I'm not done monkeying with it but I really like the results so far. I no longer need to remember to close script sections as my code does that for me. Also it closes the head section when I start the body and closes the html automatically because of the destructor.