cvs: peardoc /en/package/structures/structures-datagrid custom-datasources.xml example-advanced.xml

From: Date: Sun, 23 Apr 2006 13:13:38 +0000
Subject: cvs: peardoc /en/package/structures/structures-datagrid custom-datasources.xml example-advanced.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-7812@lists.php.net to get a copy of this message
wiesemann Sun Apr 23 13:13:38 2006 UTC Modified files: /peardoc/en/package/structures/structures-datagrid custom-datasources.xml example-advanced.xml Log: - fix code - fix typos - fix spacing issues http://cvs.php.net/viewcvs.cgi/peardoc/en/package/structures/structures-datagrid/custom-datasources.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/structures/structures-datagrid/custom-datasources.xml diff -u peardoc/en/package/structures/structures-datagrid/custom-datasources.xml:1.3 peardoc/en/package/structures/structures-datagrid/custom-datasources.xml:1.4 --- peardoc/en/package/structures/structures-datagrid/custom-datasources.xml:1.3 Fri Apr 21 16:42:30 2006 +++ peardoc/en/package/structures/structures-datagrid/custom-datasources.xml Sun Apr 23 13:13:38 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="package.structures.structures-datagrid.custom-datasources"> <refnamediv> @@ -136,9 +136,9 @@ var $db; var $orderBy = ''; - function MyDataSource () { + function MyDataSource() { $dsn = 'mysql://someuser:apasswd@localhost/thedb'; - $db =& DB::connect($dsn); + $this->db =& DB::connect($dsn); } function count() { @@ -146,7 +146,7 @@ return $this->db->getOne($query); } - function sort($sortSpec,$sortDir = 'ASC') { + function sort($sortSpec, $sortDir = 'ASC') { $this->orderBy = "ORDER BY $sortSpec $sortDir"; } @@ -185,7 +185,7 @@ $datasource->sort('weight'); -echo "Here are the 5 lightest ones : \n"; +echo "Here are the 5 lightest ones: \n"; // dump() accepts the same $offset and $len argument as fetch() $datasource->dump(0,5); @@ -194,13 +194,13 @@ </programlisting> </example> - <para>That should output a nicely formated ascii table like :</para> + <para>That should output a nicely formated ascii table like:</para> <screen> <![CDATA[ There are 23 cats in the farm. -Here are the 5 lightest ones : +Here are the 5 lightest ones: +---------+---------+-----------+--------+ | name | species | birthDate | weight | +---------+---------+-----------+--------+ @@ -243,18 +243,18 @@ </example> <para>That should output a sortable HTML table.</para> <para>Of course, the usual features of - <acronym>Structures_DataGrid</acronym> are now available to you : paging, + <acronym>Structures_DataGrid</acronym> are now available to you: paging, other output formats as XML, MS-Excel, etc...</para> </refsect1> <!-- <refsect1 id="package.structures.structures-datagrid.custom-datasources.official"> <title>Writing an official driver</title> - <para>The above example is a fully functionnal and valid <i>custom + <para>The above example is a fully functional and valid <i>custom DataSource</i>. However, if you feel like writing an official and reusable <acronym>Structures_DataGrid</acronym> driver, there's a little more to know.</para> - <para>What's an official driver ? First it must be able to + <para>What's an official driver? First it must be able to <acronym>bind</acronym> a user-provided <acronym>DataSource container</acronym>. And it may handle user options and additional features.</para> http://cvs.php.net/viewcvs.cgi/peardoc/en/package/structures/structures-datagrid/example-advanced.xml?r1=1.16&r2=1.17&diff_format=u Index: peardoc/en/package/structures/structures-datagrid/example-advanced.xml diff -u peardoc/en/package/structures/structures-datagrid/example-advanced.xml:1.16 peardoc/en/package/structures/structures-datagrid/example-advanced.xml:1.17 --- peardoc/en/package/structures/structures-datagrid/example-advanced.xml:1.16 Fri Apr 21 16:43:13 2006 +++ peardoc/en/package/structures/structures-datagrid/example-advanced.xml Sun Apr 23 13:13:38 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <refentry id="package.structures.structures-datagrid.example-advanced"> <refnamediv> @@ -26,11 +26,11 @@ require 'Structures/DataGrid.php'; require 'myclasses/User.php'; -// Instantiate the DataObject ; that's our DataSource container +// Instantiate the DataObject; that's our DataSource container $user = new User_DataObject(); // Create the DataGrid, and bind the DataSource container -$dg =& new Structures_DataGrid(20); // Display 20 per page +$dg =& new Structures_DataGrid(20); // Display 20 records per page $dg->bind($user); // Specify how the DataGrid should be sorted by default

« previous php.pear.doc (#7812) next »