HTML_PAGE2 - PEAR PHPDoc API Convertor and questions

From: Date: Sat, 28 Oct 2006 07:54:18 +0000
Subject: HTML_PAGE2 - PEAR PHPDoc API Convertor and questions
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-44779@lists.php.net to get a copy of this message
Hi I want to test the API docs generated locally. So what converter does PEAR use on its website to generate API docs? So I can match ouput correctly. I can see - XML:DocBook/peardoc2:default But I think this is used only for user documentation? I also always get these: Warning on line 48 - package HTML_Page2 is already in category HTML, will now replace with category HTML I am following the coding style but just dont see what the issue is: This is the offending section I think: Lastly the API docs on HTML_Page2 are quite extensive - but I think most of this information should reside in User Documentation, the API docs should explain the API only, please take a look at the below and Critique that please. <?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * The PEAR::HTML_Page2 package provides a simple interface for generating an * XHTML compliant page. * * Features: * - supports virtually all HTML doctypes, from HTML 2.0 through XHTML 1.1 and * XHTML Basic 1.0 plus preliminary support for XHTML 2.0 * - namespace support * - global language declaration for the document * - line ending styles * - full META tag support * - support for stylesheet declaration in the head section * - support for script declaration in the head section * - support for linked stylesheets and scripts * - full support for header <link> tags * - body can be a string, object with toHtml or toString methods or an array * (can be combined) * * Ideas for use: * - Use to validate the output of a class for XHTML compliance * - Quick prototyping using PEAR packages * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to license@php.net so we can mail you a copy immediately. * * @category HTML * @package HTML_Page2
 * @author    Triangle Solutions Ltd <iwarner@triangle-solutions.com>
 * @author    Klaus Guenther <klaus@capitalfocus.org>
 * @author    Adam Daniel <adaniel1@eesus.jnj.com>
* @copyright 1997-2006 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 * @version CVS: $Id: Page2.php,v 1.10.2.2 2006/10/25 09:48:51 iwarner Exp $
 * @link      http://pear.php.net/package/HTML_Page2
 * @link      http://wiki.triangle-solutions.com/index.php/PEAR_HTML_Page2
*/ /** * Include PEAR core */ require_once 'PEAR.php'; /** * Include HTML_Common class * * Additional required files: * * HTML/Page2/Doctypes.php is required in private method _getDoctype() * * HTML/Page2/Namespaces.php is required in private method _getNamespace() * * HTML/Page2/Frameset.php is optionally required in method setDoctype() if the * doctype variant is frameset. */ require_once 'HTML/Common.php'; // {{{ constants /**#@+ * Determines how content is added to the body. * * @see addBodyContent method */ define('HTML_PAGE2_APPEND', 0); define('HTML_PAGE2_PREPEND', 1); define('HTML_PAGE2_REPLACE', 2); /**#@-*/ // }}} // {{{ GLOBALS // }}} // {{{ HTML_Page2 /** * (X)HTML Page generation class. * * This class handles the details for creating a properly constructed XHTML * page. Page caching, stylesheets, client side script, and Meta tags can be * managed using this class.<br><br> * * The body may be a string, object, or array of objects or strings. Objects * with toHtml() and toString() methods are supported. * * <br><br><b>XHTML Examples:</b> * * <br><br>Simplest example: * * <code> * // the default doctype is XHTML 1.0 Transitional * // All doctypes and defaults are set in HTML/Page/Doctypes.php * $p = new HTML_Page2(); * * //add some content * $p->addBodyContent('some text'); * * // print to browser * $p->display(); * </code> * * Complex XHTML example: * <code> * // The array takes an array of attributes that determine many important * // aspects of the page generations. Possible attributes are: charset, mime, * //lineend, tab, doctype, namespace, language and cache * $p = new HTML_Page2(array (
 *    // Sets the charset encoding (default: utf-8)
 *    'charset' => 'utf-8',
*
 *    // Sets the line end character (default: unix (\n))
 *    'lineend' => 'unix',
*
 *    // Sets the tab string for autoindent (default: tab (\t))
 *    'tab' => '  ',
*
 *    // This is where you define the doctype
 *    'doctype' => "XHTML 1.0 Strict",
*
 *    // Global page language setting
 *    'language' => 'en',
*
 *    // If cache is set to true, the browser may cache the output.
 *    'cache' => 'false'
* )); * * // Set the page title * $p->setTitle("My page"); * * // Add optional meta data * $p->setMetaData("author", "My Name"); * * // Put something into the body * $p->addBodyContent("<p>some text</p>"); * * // If at some point you want to clear the page content * // and output an error message, you can easily do that * // See the source for {@link toHtml} and {@link _getDoctype} * // for more details * if ($error) {
 *     $p->setTitle("Error!");
 *     $p->setBody("Houston, we have a problem: $error");
 *     $p->display();
 *     die;
* } * * // print to browser * $p->display(); * // output to file * $p->toFile('example.html'); * </code> * * Simple XHTML declaration example: * <code> * $p = new HTML_Page2(); * // An XHTML compliant page (with title) is automatically generated * * // This overrides the XHTML 1.0 Transitional default * $p->setDoctype('XHTML 1.0 Strict'); * * // Put some content in here * $p->addBodyContent("some text"); * * // print to browser * $p->display(); * </code> * * <b>HTML examples:</b> * * <br><br>HTML 4.01 example: * <code> * $p = new HTML_Page2('doctype="HTML 4.01 Strict"'); * $p->addBodyContent = "some text"; * $p->display(); * </code> * * Nuke doctype declaration: * * <code> * $p = new HTML_Page2('doctype="none"'); * $p->addBodyContent = "some text"; * $p->display(); * </code> * * @package HTML_Page2 * @author Triangle Solutions Ltd <iwarner@triangle-solutions.com> * @author Klaus Guenther <klaus@capitalfocus.org> * @author Adam Daniel <adaniel1@eesus.jnj.com> */ class HTML_Page2 extends HTML_Common { Cheers Ian

« previous php.pear.dev (#44779) next »