public function _write($path, $title, $shell)
    {
        $phpdoctor =& $this->_doclet->phpdoctor();

        // make directory separators suitable to this platform
        $path = str_replace('/', DIRECTORY_SEPARATOR, $path);

        // make directories if they don't exist
        $dirs = explode(DIRECTORY_SEPARATOR, $path);
        array_pop($dirs);
        $testPath = $this->_doclet->destinationPath();
        foreach ($dirs as $dir) {
            $testPath .= $dir.DIRECTORY_SEPARATOR;
            if (!is_dir($testPath)) {
                if (!@mkdir($testPath)) {
                    $phpdoctor->error(sprintf('Could not create directory "%s"', $testPath));
                    exit;
                }
            }
        }

        // write file
        $fp = fopen($this->_doclet->destinationPath().$path, 'w');
        if ($fp) {
            $phpdoctor->message('Writing "'.$path.'"');
            fwrite($fp, $this->_htmlHeader($title));
            if ($shell) fwrite($fp, $this->_shellHeader($path));
            fwrite($fp, $this->_output);
            if ($shell) fwrite($fp, $this->_shellFooter($path));
            fwrite($fp, $this->_htmlFooter());
            fclose($fp);
        } else {
            $phpdoctor->error('Could not write "'.$this->_doclet->destinationPath().$path.'"');
            exit;
        }
    }