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

Source for file Iframe.php

Documentation is available at Iframe.php

  1. <?
  2. /**
  3. * @package page
  4. * @filesource
  5. * @see HTML_PAGE_UTIL_PATH.'/Iframe.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. require_once(HTML_BASE_UTIL_PATH.'/Links.php');
  18. require_once(HTML_BASE_UTIL_PATH.'/Images.php');
  19.  
  20. // TODO, use a default /nosrc/xxx.php if src=''
  21.  
  22. /**
  23. * Returns a complete IFRAME as HTML
  24. * <code>
  25. * <iframe name="bannerIframe" src="Banneriframe.php" width="468" height="60"
  26. * title="todo" align="right" frameborder="0" scrolling="no" marginheight="0" marginwidth="0">
  27. * <img src="/images/logo.gif" width="468" height="60" alt="todo" />
  28. * </iframe>
  29. * Usage:
  30. * $iframe = new Iframe($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
  31. * print $iframe->getHtml();
  32. * Or
  33. * Iframe::display($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
  34. * </code>
  35. * @package page
  36. */
  37.  
  38. class Iframe extends Html {
  39. var $src = '';
  40. var $width = '';
  41. var $height = '';
  42. var $align = '';
  43. var $frameborder = '';
  44. var $marginheight = '';
  45. var $marginwidth = '';
  46. var $scrolling = '';
  47. var $name = '';
  48. var $title = '';
  49. var $class = '';
  50. var $target = '';
  51.  
  52. /**
  53. * Constructor
  54. * @param String $src The html to use inside the iframe
  55. * @param String $width The width of the iframe
  56. * @param String $height The height of the iframe
  57. * @param String $align The align of the iframe
  58. * @param String $frameborder The frameborder of the iframe
  59. * @param String $marginheight The marginheight of the iframe
  60. * @param String $marginwidth The marginwidth of the iframe
  61. * @param String $scrolling The scrolling of the iframe
  62. * @param String $name The name of the iframe
  63. * @param String $title The title of the iframe
  64. * @param String $class The css class of the iframe
  65. */
  66. function Iframe($src='',$width='',$height='',$align='',$frameborder='',$marginheight='',$marginwidth='',$scrolling='',$name='',$title='',$class='') {
  67. $this->Html();
  68. $this->src = $src!=''?$src:IFRAME_SRC;
  69. $this->width = $width!=''?$width:IFRAME_WIDTH;
  70. $this->height = $height!=''?$height:IFRAME_HEIGHT;
  71. $this->align = $align!=''?$align:IFRAME_ALIGN;
  72. $this->frameborder = $frameborder!=''?$frameborder:IFRAME_FRAMEBORDER;
  73. $this->marginheight = $marginheight!=''?$marginheight:IFRAME_MARGINHEIGHT;
  74. $this->marginwidth = $marginwidth!=''?$marginwidth:IFRAME_MARGINWIDTH;
  75. $this->scrolling = $scrolling!=''?$scrolling:IFRAME_SCROLLING;
  76. $this->name = $name!=''?$name:IFRAME_NAME;
  77. $this->title = $title!=''?$title:IFRAME_TITLE;
  78. $this->class = $class!=''?$class:IFRAME_CLASS;
  79. $this->target = 'self';
  80. }
  81.  
  82. /**
  83. * Get the complete html for an IFRAME
  84. * @return String, the html
  85. */
  86. function getHtml() {
  87. $html = $this->html;
  88. if ($this->src!='') {
  89. $html .= '<iframe';
  90. $html .= $this->getAttribute('src');
  91. $html .= $this->getAttribute('width');
  92. $html .= $this->getAttribute('height');
  93. $html .= $this->getAttribute('align');
  94. $html .= $this->getAttribute('frameborder');
  95. $html .= $this->getAttribute('marginwidth');
  96. $html .= $this->getAttribute('marginheight');
  97. $html .= $this->getAttribute('scrolling');
  98. $html .= $this->getAttribute('name');
  99. $html .= $this->getAttribute('title');
  100. $html .= $this->getAttribute('class');
  101. $html .= $this->getAttribute('target');
  102. $html .= ">\r\n";
  103. $link = new Links(LINK_MAIL);
  104. $link->add(new Images(IMAGE_LOGO,$this->width,$this->height,IFRAME_TITLE,CSS_BANNER));
  105. $html .= $link->getHtml();
  106. $html .= "</iframe>"; // DO NOT use \r\n if inside a td
  107. } else {
  108. $html .= '<!-- '.$this->getClassName()."->getHtml(), src is empty -->\r\n";
  109. }
  110. return $html;
  111. }
  112.  
  113. /**
  114. * Display html
  115. * <code>
  116. * Usage:
  117. * Iframe::display($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
  118. * </code>
  119. * @static
  120. * @param String $src The html to use inside the iframe
  121. * @param String $width The width of the iframe
  122. * @param String $height The height of the iframe
  123. * @param String $align The align of the iframe
  124. * @param String $frameborder The frameborder of the iframe
  125. * @param String $marginheight The marginheight of the iframe
  126. * @param String $marginwidth The marginwidth of the iframe
  127. * @param String $scrolling The scrolling of the iframe
  128. * @param String $name The name of the iframe
  129. * @param String $title The title of the iframe
  130. * @param String $class The css class of the iframe
  131. */
  132. function display($src='',$width='',$height='',$align='',$frameborder='',$marginheight='',$marginwidth='',$scrolling='',$name='',$title='',$class='') {
  133. $html = new Iframe($src,$width,$height,$align,$frameborder,$marginheight,$marginwidth,$scrolling,$name,$title,$class);
  134. $html->addHtml();
  135. }
  136. }
  137. ?>

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