HTML_Page2
[ class tree: HTML_Page2 ] [ index: HTML_Page2 ] [ all elements ]

Source for file Page2_Complex.php

Documentation is available at Page2_Complex.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997 - 2004 The PHP Group                              |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 3.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/3_0.txt.                                  |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Author: Klaus Guenther <klaus@capitalfocus.org>                      |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id$
  20.  
  21. require_once 'HTML/Page2.php';
  22. require_once 'HTML/Table.php';
  23.  
  24. // This is an example from HTML_Table
  25. $table = new HTML_Table('width=100%');
  26. $table->setCaption('256 colors table');
  27. $i $j = 0;
  28. for ($R = 0; $R <= 255; $R += 51{
  29.     for ($G = 0; $G <= 255; $G += 51{
  30.         for($B = 0; $B <= 255; $B += 51{
  31.             $table->setCellAttributes($i$j
  32.              'style="background-color:#'.strtolower(sprintf('%02X%02X%02X'
  33.                                                               $R$G$B)).';"');
  34.             $j++;
  35.         }
  36.     }
  37.     $i++;
  38.     $j = 0;
  39. }
  40. // end of HTML_Table example
  41.  
  42. // The initializing code can also be in in the form of an HTML
  43. // attr="value" string.
  44. // Possible attributes are:
  45. //      - cache ("true" or "false")
  46. //      - charset (e.g., "utf-8")
  47. //      - doctype (e.g., "XHTML Basic 1.0")
  48. //      - language (two letter designator: e.g., "en")
  49. //      - lineend ("unix", "win", "mac", custom string)
  50. //      - mime (e.g., "application/xhtml+xml")
  51. //      - namespace (URI)
  52. //      - profile (URI)
  53. //      - tab (e.g., "    ")
  54. //      - disableProlog (bool)
  55. // All the above have defaults, so it is not necessary
  56. // to specify everything. For example, the proper namespace
  57. // is chosen by default.
  58.  
  59. $page = new HTML_Page2(array 
  60.                            'lineend'   => 'unix',
  61.                            'doctype'   => 'XHTML 1.0 Strict',
  62.                            'language'  => 'en',
  63.                            'cache'     => 'false',
  64.                            'tab'       => '  '
  65.                          ));
  66.  
  67. // Page title defaults to "New $doctypeString Compliant Page"
  68. $page->setTitle("HTML_Page2 Color Chart example");
  69. $page->setMetaData("author""Klaus Guenther");
  70.  
  71. // let's add a Content-Type meta tag
  72. $page->setMetaContentType();
  73.  
  74. // Objects with toHtml and toString are supported.
  75. $page->addBodyContent($table);
  76. $page->addBodyContent('<p>Copyright 2003 The PHP Group</p>');
  77.  
  78. // oops, forgot to add the header:
  79. $page->addBodyContent("<h1>Color Chart</h1>"HTML_PAGE2_PREPEND);
  80.  
  81. // output to browser
  82. $page->display();
  83. // or to a file
  84. //$page->toFile('example.html');
  85. ?>

Documentation generated on Mon, 11 Mar 2019 16:03:54 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.