示例#1
0
 /**
  * Magic Method that appends a new Sprocket to this one.
  * 
  * Takes the name of the method and creates a new sprocket of that
  * tag name.  ($div->p() would create a new <p> tag under $div, 
  * assuming $div is a Sprocket.)
  * 
  * Takes the parameter and appends it to the new Sprocket.  
  * ($div->p('This is a test'); would add the text "This is a test" to 
  * the new <p> tag.)
  * 
  * Then, appends the new sprocket to this Sprocket.
  * 
  * Finally, returns a reference to the new Sprocket, so you can 
  * fluidly chain these.  $sprocket->div('This is a bold ')->b('example');
  *
  * @param string name of the tag to append (the called method)
  * @param mixed Data to add  (the parameter on the called method)
  * @return refernce to the newly appended sprocket, for fluid notation
  */
 public function __call($name, $values)
 {
     // this is the default tag constructor
     $new_tag = new Sprocket($name);
     // pass the values to the tag
     $new_tag->addArray($values);
     $this->add($new_tag);
     return $new_tag;
 }