HI there,
I like to pdf some nodes via a views list of nodes - it's working..!:-) BUT.. in some nodes are image galleries. Dompdf don't support floats yet.. in version 0.5
In oder to that I try to print the images in a table. It's working for an single node, but is not working for my "node list" (display full nodes - with commments).
If I pdf the node list I got this error:
array_chunk() expects parameter 1 to be array, null given in /is/htdocs/xx/themes/xx/print_pdf.tpl.php in Zeile 46.
Invalid argument supplied for foreach() in /is/htdocs/xx/themes/xx/print_pdf.tpl.php in Zeile 56.
What could be the cause?
This is my print_pdf.tpl.php
<?php
// $Id: print.blog_public.tpl.php,v 1.8.2.17 2010/08/18 00:33:34 xx Exp $
/**
* @file
* Default print module template
*
* @ingroup print
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $print['language']; ?>" xml:lang="<?php print $print['language']; ?>">
<head>
<?php print $print['head']; ?>
<?php print $print['base_href']; ?>
<?php print $print['scripts']; ?>
<?php print $print['sendtoprinter']; ?>
<?php print $print['css']; ?>
</head>
<body>
<?php $node = $print['node']; ?>
<div id="page-print">
<?php if (!empty($print['message'])) {
print '<div class="print-message">'. $print['message'] .'</div><p />';
} ?>
<div class="print-logo"><?php print $print['logo']; ?></div>
<div class="print-site_name"><?php print $print['site_name']; ?></div>
<p />
<hr class="print-hr" />
<div class="print-content"><?php print $print['content']; ?></div>
<?php
$columns = 3;
$items = array();
$items = $node->field_image_upload;
$result = count($items);
$rows = array_chunk($items, $columns);
?>
<?php if (!$field_empty) : ?>
<table class="mini-gallery">
<tbody>
<?php foreach ($rows as $row_number => $columns): ?>
<?php
$row_class = 'row-' . ($row_number + 1);
if ($row_number == 0) {
$row_class .= ' row-first';
}
if (count($rows) == ($row_number + 1)) {
$row_class .= ' row-last';
}
?>
<tr class="<?php print $row_class; ?>">
<?php foreach ($columns as $column_number => $item): ?>
<td class="<?php print 'col-'. ($column_number + 1); ?>">
<div class="photo-image"><?php print $item['view']; ?></div>
<div class="photo-title"><?php print $item['data']['title']; ?><div>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<hr class="print-hr" />
</div>
</body>
</html>
Comments
Comment #1
jcnventuraI can't support bugs in user's custom templates..