Located in File: /src/QueryPath/Extension/QPTPL.php
The QPTPL extension provides template tools that can be used in conjunction with QueryPath.
There are two basic modes in which this tool operates. Both merge data into a pure HTML template. Both base their insertions on classes and IDs in the HTML data. Where they differ is in the kind of data merged into the template.
One mode takes array data and does a deep (recursive) merge into the template. It can be used for simple substitutions, but it can also be used to loop through "rows" of data and create tables.
The second mode takes a classed object and introspects that object to find out what CSS classes it is capable of filling. This is one way of bridging an object model and QueryPath data.
The unit tests are a good place for documentation, as is the QueryPath webste.
Constructor __construct (line 33)
Method isAssoc (line 238)
If the keys of the array are not consecutive integers starting with 0, this will return false.
Method method2class (line 252)
Method tpl (line 71)
This takes a template (an arbitrary fragment of XML/HTML) and an object or array and inserts the contents of the object into the template. The template is then appended to all of the nodes in the current list.
Note that the data in the object is *not* escaped before it is merged into the template. For that reason, an object can return markup (as long as it is well-formed).
Method tplAll (line 102)
Using this method, one template can be populated from a variety of sources. That one template is then appended to the QueryPath object.
Method tplArrayR (line 189)
Method tplObject (line 167)