before() 공개 메소드

This will take the give data (XML or HTML) and put it before each of the items that the DOMQuery object currently contains. Contrast this with after().
또한 보기: insertBefore()
또한 보기: after()
또한 보기: append()
또한 보기: prepend()
public before ( mixed $data )
$data mixed The data to be inserted. This can be XML in a string, a DomFragment, a DOMElement, or the other usual suspects. (See {@link qp()}).
예제 #1
0
 /**
  * Insert the current elements into the destination document.
  * The items are inserted before each element in the given DOMQuery document.
  * That is, they will be siblings with the current elements.
  *
  * @param DOMQuery $dest
  *  Destination DOMQuery document.
  * @retval object DOMQuery
  *  The current DOMQuery object, unaltered. Only the destination DOMQuery
  *  object is altered.
  * @see before()
  * @see insertAfter()
  * @see appendTo()
  * @throws QueryPath::Exception
  *  Thrown if $data is an unsupported object type.
  */
 public function insertBefore(DOMQuery $dest)
 {
     foreach ($this->matches as $m) {
         $dest->before($m);
     }
     return $this;
 }