HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/mm.paycheckc.com/vendor/electrolinux/phpquery/wiki/MultiDocumentSupport.md
## What MultiDocumentSupport is
  * support for working on several documents in same time
  * easy importing of nodes from one document to another
  * pointing document thought
    * phpQuery object
    * [DOMNode](http://www.php.net/manual/en/class.domnode.php) object
    * [DOMDocument](http://www.php.net/manual/en/class.domdocument.php) object
    * internal document ID
  * last created (or selected) document is assumed to be default in pq();
## What MultiDocumentSupport is NOT
  * it's **not possible** to fetch nodes from several document in one query
  * it's **not possible** to operate on nodes from several document in one phpQuery object

## Example
```
// first three documents are wrapped inside phpQuery
$doc1 = phpQuery::newDocumentFile('my-file.html');
$doc2 = phpQuery::newDocumentFile('my-file.html');
$doc3 = phpQuery::newDocumentFile('my-other-file.html');
// $doc4 is plain DOMDocument
$doc4 = new DOMDocument;
$doc4->loadHTMLFile('my-file.html');
// find first UL list in $doc1
$doc1->find('ul:first')
  // append all LIs from $doc2 (node import)
  ->append( $doc2->find('li') )
  // append UL (with new LIs) into $doc3 BODY (node import)
  ->appendTo( $doc3->find('body') );
// this will find all LIs from $doc3
// thats because it was created as last one
pq('li');
// this will find all LIs inside first UL in $doc2 (context query)
pq('li', $doc2->find('ul:first')->get());
// this will find all LIs in whole $doc2 (not a context query)
pq('li', $doc2->find('ul:first')->getDocumentID());
// this will transparently load $doc4 into phpQuery::$documents
// and then all LIs will be found
// TODO this example must be verified
pq('li', $doc4); 
```
## Static Methods
  * phpQuery::**newDocument**($html) Creates new document from markup
  * phpQuery::**newDocumentFile**($file) Creates new document from file
  * phpQuery::**getDocument**($id = null) Returns phpQueryObject containing document with id $id or  default document (last created/selected)
  * phpQuery::**selectDocument**($id) Sets default document to $id
  * phpQuery::**unloadDocuments**($id = null) Unloades all or specified document from memory
  * phpQuery::**getDocumentID**($source) Returns $source's document ID
  * phpQuery::**getDOMDocument**($source) Get DOMDocument object related to $source
## Object Methods
  * $pq->**getDocument**() Returns object with stack set to document root
  * $pq->**getDocumentID**() Get object's Document ID
  * $pq->**getDocumentIDRef**(&$documentID) Saves object's DocumentID to $var by reference
  * $pq->**unloadDocument**() Unloads whole document from memory