phpDocumentor page
[ class tree: page ] [ index: page ] [ all elements ]

Source for file Document.php

Documentation is available at Document.php

  1. <?
  2. /**
  3. * @package page
  4. * @filesource
  5. * @see HTML_PAGE_UTIL_PATH.'/Document.php'
  6. * @copyright (c) http://Finn-Rasmussen.com
  7. * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
  8. * @author http://Finn-Rasmussen.com
  9. * @version 1.9
  10. * @since 21-oct-2005
  11. */
  12.  
  13. /**
  14. * The required files
  15. */
  16. require_once(HTML_PATH.'/Html.php');
  17.  
  18. /**
  19. * Generates a javascript
  20. * <code>
  21. * <script type="text/javascript">document.write(...)</script>
  22. * Usage:
  23. * $html = new Document($text);
  24. * print $html->getHtml();
  25. * Or
  26. * Document::display($text);
  27. * </code>
  28. * @package page
  29. */
  30.  
  31. class Document extends Html {
  32. /**
  33. * @var String $text The Text or an object
  34. */
  35. var $text = '';
  36.  
  37. /**
  38. * Constructor
  39. * @param String $text The text for the javascript document.write(...)
  40. */
  41. function Document($text='') {
  42. $this->Html();
  43. $this->text = $text;
  44. }
  45.  
  46. /**
  47. * Returns the html for the javascript document.write html element
  48. * @return String the complete html
  49. */
  50. function getHtml() {
  51. $html = '';
  52. $html .= "\r\n".'<script type="text/javascript">'."\r\n";
  53. $html .= "<!-- \r\n";
  54. $html .= 'document.write('.$this->text.")\r\n"; // Have some fun';
  55. $html .= "// -->\r\n";
  56. $html .= "</script>\r\n";
  57. return $html;
  58. }
  59.  
  60. /**
  61. * Display html
  62. * <code>
  63. * Usage:
  64. * Document::display($text);
  65. * </code>
  66. * @static
  67. * @param String $text The text for the div or an object
  68. */
  69. function display($text='') {
  70. $html = new Document($text);
  71. $html->addHtml();
  72. }
  73. }
  74. ?>

Documentation generated on Thu, 22 Dec 2005 17:07:27 +0100 by phpDocumentor 1.3.0RC3