cvs: peardoc /en/package/structures/structures-datagrid faq.xml

From: Date: Sat, 30 Sep 2006 07:50:07 +0000
Subject: cvs: peardoc /en/package/structures/structures-datagrid faq.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-8549@lists.php.net to get a copy of this message
wiesemann Sat Sep 30 07:50:07 2006 UTC Modified files: /peardoc/en/package/structures/structures-datagrid faq.xml Log: - add new FAQ entry (per user request) http://cvs.php.net/viewvc.cgi/peardoc/en/package/structures/structures-datagrid/faq.xml?r1=1.1&r2=1.2&diff_format=u Index: peardoc/en/package/structures/structures-datagrid/faq.xml diff -u peardoc/en/package/structures/structures-datagrid/faq.xml:1.1 peardoc/en/package/structures/structures-datagrid/faq.xml:1.2 --- peardoc/en/package/structures/structures-datagrid/faq.xml:1.1 Wed Aug 16 21:10:01 2006 +++ peardoc/en/package/structures/structures-datagrid/faq.xml Sat Sep 30 07:50:06 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1" ?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.structures.structures-datagrid.faq"> <refnamediv> <refname>FAQ</refname> @@ -146,6 +146,40 @@ <qandaentry> <question> <para> + How do I use the formatter with my own arguments? + </para> + </question> + <answer> + <para> + The following example shows a printDesc function which appends '...' to + a string if the length exceeds the given size. This size can be specified + for every column differently via an array element with the key 'length' + as the last parameter of the column constructor. +<programlisting role="php"> +<![CDATA[ +// example column, relevant for this example are only the last two parameters +$datagrid->addColumn(new Structures_DataGrid_Column('Description', 'description', + 'description', null, null, 'printDesc', array('length' => 15))); + +function printDesc($params, $args) +{ + extract($params); + extract($args); + + if (strlen($record[$fieldName]) > $length) { + return nl2br(substr($record[$fieldName], 0, $length)) . '...'; + } else { + return nl2br($record[$fieldName]); + } +} +]]> +</programlisting> + </para> + </answer> + </qandaentry> + <qandaentry> + <question> + <para> I'm using the Excel Renderer and would like to have the &euro; sign in the resulting Excel file, but I always get only a box or some funny characters. How can I get the right &euro; sign?

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