<?php
require_once 'Structures/DataGrid.php';
$dg =& new Structures_DataGrid();
$dg->bind('http://pear.php.net/feeds/pkg_structures_datagrid.rss', null, 'RSS');
$dg->addColumn(new Structures_DataGrid_Column('Release', 'title', 'title', null, null, 'printLink()'));
$dg->addColumn(new Structures_DataGrid_Column('Description', 'description', 'description', null, null, 'printDesc($length=150)'));
$dg->addColumn(new Structures_DataGrid_Column('Date', 'dc:date', 'dc:date'));
$dg->render();
function printLink($params)
{
extract($params);
return '<a href="' . $record['link'] . '">' . $record['title'] . '</a>';
}
function printDesc($params)
{
extract ($params);
if (strlen($record['description']) > $length) {
return nl2br(substr($record['description'], 0, $length)) . '...';
} else {
return nl2br($record['description']);
}
}
?> |