Advertisement
wandrake

Untitled

Mar 4th, 2012
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. <?php
  2.     require_once("$prefix/utils/Element.php");
  3.    
  4.     class Div extends Element {
  5.        
  6.         function Div($id = "", $class = "") {
  7.             $this->_id = $id;
  8.             if ($class != "") $this->addClass($class);
  9.         }
  10.        
  11.         public function html() {
  12.             $ret  = '<div';
  13.            
  14.             if ($this->hasIdAttr()) {
  15.                 $ret = rtrim(sprintf("%s %s", $ret, $this->getIdAttr()));
  16.             }
  17.            
  18.             if ($this->hasClassAttr()) {
  19.                 $ret = rtrim(sprintf("%s %s", $ret, $this->getClassAttr()));
  20.             }
  21.            
  22.             if ($this->hasStyleAttr()) {
  23.                 $ret = rtrim(sprintf("%s %s", $ret, $this->getStyleAttr()));
  24.             }
  25.            
  26.             $ret .= ">\n";
  27.            
  28.             for ($i = 0; $i < $this->_idx; $i++) {
  29.                 $ret .= $this->_elements[$i]->html() . "\n";
  30.             }
  31.            
  32.             $ret .= "</div>\n";
  33.            
  34.             return $ret;
  35.         }
  36.        
  37.     }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement