Possible template problem with latest version

8 views
Skip to first unread message

steve

unread,
Aug 20, 2010, 9:02:50 AM8/20/10
to devel-querypath
I'm trying out QP 2.1 to use the new abbr() option but I think this
version is causing a problem with templates.
The template documentation shows an example of filling a table. This
works just great in 2.0 but when I try it in 2.1 I get:

Warning: SplObjectStorage::attach() expects parameter 1 to be object,
null given in C:\wamp\www\cms\querypath\QueryPath.php on line 1206

Fatal error: Call to a member function createDocumentFragment() on a
non-object in C:\wamp\www\cms\querypath\QueryPath.php on line 1717

The simpler example of filling a list works fine in 2.1

Thanks, Steve.

Code:

<?php

require_once("QueryPath/QueryPath.php");
require_once("QueryPath/Extension/QPTPL.php");

// Define the template
$tpl = '<?xml version="1.0"?><table>
<tbody>
<tr class="header-row">
<th class="header1"/>
<th class="header2"/>
</tr>
<tr class="table-row">
<td class="cell1"></td>
<td class="cell2"></td>
</tr>
</tbody>
</table>';

// Define the data
$data['.header1'][] = 'Header One';
$data['.header2'][] = 'Header Two';
$data['.table-row'][] = array(
'.cell1' => 'Cell One',
'.cell2' => 'Cell Two',
);
$data['.table-row'][] = array(
'.cell1' => 'Cell Three',
'.cell2' => 'Cell Four',
);
$data['.table-row'][] = array(
'.cell1' => 'Cell Five',
'.cell2' => 'Cell Six',
);

// Merge the template and write out the results.
qp()->tpl($tpl, $data)->writeHTML();

?>

TechnoSophos

unread,
Aug 20, 2010, 10:30:35 AM8/20/10
to devel-q...@googlegroups.com
This is now issue #26 in the bug queue. I've marked it as critical.
http://github.com/technosophos/querypath/issues/issue/26

Thanks very much for the detailed report.

Matt

> --
> You received this message because you are subscribed to the Google Groups "devel-querypath" group.
> To post to this group, send email to devel-q...@googlegroups.com.
> To unsubscribe from this group, send email to devel-querypa...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/devel-querypath?hl=en.
>
>

--
http://technosophos.com
http://querypath.org

Reply all
Reply to author
Forward
0 new messages