- <?
- /**
- * @package page
- * @filesource
- * @see HTML_PAGE_UTIL_PATH.'/Document.php'
- * @copyright (c) http://Finn-Rasmussen.com
- * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
- * @author http://Finn-Rasmussen.com
- * @version 1.9
- * @since 21-oct-2005
- */
-
- /**
- * The required files
- */
- require_once(HTML_PATH.'/Html.php');
-
- /**
- * Generates a javascript
- * <code>
- * <script type="text/javascript">document.write(...)</script>
- * Usage:
- * $html = new Document($text);
- * print $html->getHtml();
- * Or
- * Document::display($text);
- * </code>
- * @package page
- */
-
- class Document extends Html {
- /**
- * @var String $text The Text or an object
- */
- var $text = '';
-
- /**
- * Constructor
- * @param String $text The text for the javascript document.write(...)
- */
- function Document($text='') {
- $this->Html();
- $this->text = $text;
- }
-
- /**
- * Returns the html for the javascript document.write html element
- * @return String the complete html
- */
- function getHtml() {
- $html = '';
- $html .= "\r\n".'<script type="text/javascript">'."\r\n";
- $html .= "<!-- \r\n";
- $html .= 'document.write('.$this->text.")\r\n"; // Have some fun';
- $html .= "// -->\r\n";
- $html .= "</script>\r\n";
- return $html;
- }
-
- /**
- * Display html
- * <code>
- * Usage:
- * Document::display($text);
- * </code>
- * @static
- * @param String $text The text for the div or an object
- */
- function display($text='') {
- $html = new Document($text);
- $html->addHtml();
- }
- }
- ?>