cvs: peardoc /en/package/structures/structures-datagrid formatter.xml
| From: | Mark Wiesemann | Date: | Fri, 19 Jan 2007 14:15:27 +0000 |
| Subject: | cvs: peardoc /en/package/structures/structures-datagrid formatter.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-9328@lists.php.net to get a copy of this message | ||
wiesemann Fri Jan 19 14:15:27 2007 UTC
Modified files:
/peardoc/en/package/structures/structures-datagrid formatter.xml
Log:
- added information about the parameters of the callback functions
- made the $args parameters optional (to avoid PHP warnings)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/structures/structures-datagrid/formatter.xml?r1=1.6&r2=1.7&diff_format=u
Index: peardoc/en/package/structures/structures-datagrid/formatter.xml
diff -u peardoc/en/package/structures/structures-datagrid/formatter.xml:1.6
peardoc/en/package/structures/structures-datagrid/formatter.xml:1.7
--- peardoc/en/package/structures/structures-datagrid/formatter.xml:1.6 Sun Oct 1 14:15:21 2006
+++ peardoc/en/package/structures/structures-datagrid/formatter.xml Fri Jan 19 14:15:27 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<refentry id="package.structures.structures-datagrid.formatter">
<refnamediv>
<refname>Column Formatter</refname>
@@ -42,7 +42,7 @@
);
$dg->render();
-function printLink($params, $args)
+function printLink($params, $args = array())
{
extract($params);
extract($args);
@@ -50,7 +50,7 @@
return '<a href="' . $record['link'] . '">' .
$record['title'] . '</a>';
}
-function printDesc($params, $args)
+function printDesc($params, $args = array())
{
extract($params);
extract($args);
@@ -65,6 +65,61 @@
]]>
</programlisting>
</example>
+
+ <para>
+ Each callback function needs to accept at least one parameter
+ (<parameter>$params</parameter> in the example above). This parameter
+ will contain various information:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>'record'</emphasis>: An array containing the complete
current
+ record
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>'fieldName'</emphasis>: The field name of the current column
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>'columnName'</emphasis>: The column name of the current
column
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>'orderBy'</emphasis>: The 'orderBy' argument of
the current
+ column
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>'attribs'</emphasis>: The attributes of the current column
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>'currRow'</emphasis>: The number of the current row
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>'currCol'</emphasis>: The number of the current column
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ An optional second parameter (<parameter>$args</parameter> in the example)
+ allows you to pass additional information to the callback functions. In the
+ example above, an array with length information is passed when the callback
+ function <function>printDesc</function> is called for the description
+ column. Please note that this second parameter is only passed when you
+ specify something in the column constructor. Therefore, it is a good
+ practice to use <literal>$args = array()</literal> in the parameter list
+ of your callback functions.
+ </para>
</refsect1>
</refentry>