Class TM::PHPDoc by Thiemo Mättig
Version 2003-11-13

TM::PHPDoc parses a single PHP class and creates a nice looking HTML documentation in PHPDoc/phpDocu(mentor)/JavaDoc style.

See PHPDoc() for an example.

Don't hesitate to report bugs or feature requests.

Variable Summary
templates -- HTML templates.
type -- Summary and detail headlines.

Constructor Summary
PHPDoc -- Creates a PHPDoc object.

Method Summary
display -- Creates the documentation and prints it to the browser.
toHtml -- Creates the documentation and returns it as a string.

Variable Detail

templates

HTML templates.

array $templates

Associative array containing all the tiny, nested HTML template strings. Default is a nice looking, CSS based, green style similar to the PEAR and PHP manuals. Example:

// Puts a beige background to "method summary" etc.
$doc->templates['summaryhead'] =
    "<p><b style=\"background:beige\">{summaryhead}<br>";
// Puts a tan border to "method detail" etc.
$doc->templates['detailhead'] =
    "<h2 style=\"border:5px solid tan\">{detailhead}</h2>";
Note: Default headline color in JavaDoc is "#CCCCFF".

type

Summary and detail headlines.

array $type

Two-dimensional, associative array containing the variable ('0'), constructor ('1') and method ('2') headlines for both 'summary' and 'detail' view. Example:

// Replaces the "Variable Summary" headline.
$doc->type[0]['summary'] = "Summary of all public properties";

Constructor Detail

PHPDoc

Creates a PHPDoc object.

PHPDoc PHPDoc ( string filename [, bool allowJavaDocHtml])

Returns a new PHPDoc object containing the class information already parsed (calls parse() internaly). Example:

<?php
require_once("PHPDoc.class.php");
$doc = new PHPDoc("PHPDoc.class.php");
$doc->display();
?>
Parameters:
filename - Class file to parse.
allowJavaDocHtml - Allow <br>, <ol>, <ul> and stuff in descriptions.

Method Detail

display

Creates the documentation and prints it to the browser.

void display ( void)

See also toHtml().

toHtml

Creates the documentation and returns it as a string.

string toHtml ( void)

The HTML documentation returned may be printed to the browser using echo or stored to a file. Example:

$fp = fopen("manual.html", "w");
fwrite($fp, $doc->toHtml());
fclose($fp);

See also display().

Documentation generated by TM::PHPDoc