phpQuery::pq
Multi-purpose function.
Use pq() as shortcut. In below examples, $pq is any result of pq(); function. 1. Import markup into existing document (without any attaching): - Import into selected document: pq('<div/>') // DOESNT accept text nodes at beginning of input string ! - Import into document with ID from $pq->getDocumentID(): pq('<div/>', $pq->getDocumentID()) - Import into same document as DOMNode belongs to: pq('<div/>', DOMNode) - Import into document from phpQuery object: pq('<div/>', $pq) 2. Run query: - Run query on last selected document: pq('div.myClass') - Run query on document with ID from $pq->getDocumentID(): pq('div.myClass', $pq->getDocumentID()) - Run query on same document as DOMNode belongs to and use node(s)as root for query: pq('div.myClass', DOMNode) - Run query on document from phpQuery object and use object's stack as root node(s) for query: pq('div.myClass', $pq)
Signature
public function pq(string|DOMNode|DOMNodeList|array
$arg1,
[string|phpQueryObject|DOMNode
$context = NULL] )
Parameters
$arg1
— object- HTML markup, CSS Selector, DOMNode or array of DOMNodes
$context
— object- DOM ID from $pq->getDocumentID(), phpQuery object (determines also query root) or DOMNode (determines also query root)
Returns
- phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery|QueryTemplatesPhpQuery|false
phpQuery object or false in case of error.