cvs: peardoc /en/package/structures/structures-datagrid/structures-datagrid-datasource create.xml

From: Date: Fri, 28 Jan 2005 15:25:38 +0000
Subject: cvs: peardoc /en/package/structures/structures-datagrid/structures-datagrid-datasource create.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-5487@lists.php.net to get a copy of this message
asnagy Fri Jan 28 10:25:38 2005 EDT Modified files: /peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource create.xml Log: Added an example and more text http://cvs.php.net/diff.php/peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource/create.xml?r1=1.1&r2=1.2&ty=u Index: peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource/create.xml diff -u peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource/create.xml:1.1 peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource/create.xml:1.2 --- peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource/create.xml:1.1 Tue Dec 21 14:56:31 2004 +++ peardoc/en/package/structures/structures-datagrid/structures-datagrid-datasource/create.xml Fri Jan 28 10:25:38 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.structures.structures_datagrid.structures_datagrid.datasource.create"> <refnamediv> @@ -29,6 +29,10 @@ This method will create the datasource driver object by attempting to detect it's type. If the type can be found the driver will be instantiated and returned, if it cannot be detected, an error will be returned. + When using bundled data drivers, the bind() method is the preferred approach, + this method exists for those who wish to create their own data source driver. + If you do create your own driver and find that it may be useful to others, + please post it to the mailing list so that it could be bundled into the package. </para> </refsect1> @@ -85,6 +89,29 @@ &note.canstatic; </refsect1> + <refsect1 id="package.structures.structures_datagrid.structures_datagrid.datasource.create.example"> + &title.example; + <example> + <title>Creating a datasource object.</title> + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'Structures/DataGrid.php'; +require_once 'myDataObjects/User.php'; + +$user = new User(); + +$dg =& new Structures_DataGrid(); +$ds = Structures_DataGrid_DataSource::create($user); +$dg->bindDataSource($ds); + +$dg->render(); +?> + ]]> + </programlisting> + </example> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file

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