<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
  <title>PHP DataGrid</title>
  <link rel="stylesheet" href="main.css" media="screen" />
</head>
<body>
<div align="center" title="page">

  <div class="banner">
    <img src="images/datagrid-banner-left.gif" align="left">
    <img src="images/pear-icon2.gif" align="left" vspace="3">
    <img src="images/datagrid-banner-right.gif" align="right">
    <div class="logo">PHP DataGrid</div>
  </div>

  <div class="nav">
    <a href="http://pear.php.net/package/Structures_DataGrid/download/">Download</a> | 
    <a href="http://pear.php.net/manual/en/package.structures.structures-datagrid.php">Documentation</a> |
    <a href="http://cvs.php.net/pear/Structures_DataGrid/DataGrid/Docs/Examples/">Examples</a> |
    <a href="http://pear.php.net/bugs/report.php?package=Structures_DataGrid">Submit a Bug</a>
  </div>
  
  <div class="content">
    <p align="left">
      PEAR's Structures_DataGrid (SDG) package offers a toolkit to build a
      DataGrid in a PHP based environment.  It allows you, the application
      programmer, to build and deploy with very few lines of code and in a
      short period of time a complete datagrid with paging and sorting.  You can
      also render the output in many formats other than HTML, such as an Excel
      Spreadsheet or an XUL document.
    </p>
  
    <hr size="1" width="90%" noshade />
    
<?php
require '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'nullnull'printLink()'));
$dg->addColumn(new Structures_DataGrid_Column('Description''description''description'nullnull'printDesc()'));
$dg->addColumn(new Structures_DataGrid_Column('Date''dc:date''dc:Date'nullnull'printDate()'));
$dg->renderer->setTableAttribute('class''datagrid');
$dg->renderer->setTableHeaderAttributes(array('bgcolor' => '#CCCCCC'));
$dg->render();

function 
printLink($params)
{
    
extract($params);
    return 
'<a href="' $record['link'] . '">' $record['title'] . '</a>';
}

function 
printDesc($params)
{
    
extract($params);
    if (
strlen($record['description']) > 100) {
        return 
nl2br(substr($record['description'], 0100)) . '...';
    } else {
        return 
nl2br($record['description']);
    }
}

function 
printDate($params)
{
    
extract($params);
    
$date str_replace('T'' '$record['dc:date']);
    
$date substr($date019);
    return 
date('M j, Y g:i:sa'strtotime($date));
}
?>
    <br/>
  </div>
  
  <div class="footer">
    <span align="left">Copyright &copy; 2004-2005 Andrew Nagy.</span>
    <span align="right"><a href="index.phps">View Source</a></span>
  </div>

</div>
</body>
</html>