Actually, you could do the column values in the options hash as well:
$options = array(
'columnWidths' => array(9, 8),
'separation' => 'header',
'decorator' => 'Ascii',
'padding' => 1
);
$table = new Zend_Text_Table($options);
By the way, in the future you should be able to auto-size the table around
the data it contains.
-Matt
On Mon, Nov 10, 2008 at 9:39 AM, Matthew Ratzloff
<[EMAIL PROTECTED]>wrote:
> It used to be called Zend_Ascii:
> <http://framework.zend.com/wiki/display/ZFPROP/Zend_Ascii+-+Ben+Scholzen>Zend_Ascii
> - Ben Scholzen - Zend Framework
> Wiki<http://framework.zend.com/wiki/display/ZFPROP/Zend_Ascii+-+Ben+Scholzen>
> As is typical, I finally had time to play around with it only after it had
> been promoted to trunk. ;-) As a result, I have some suggestions:
>
> - It desperately needs an option for padding. Having everything butt up
> against the left or right (if not centered) doesn't look quite right. I'd
> set the default padding to 1, so that things look like this:
>
> +---------+--------+
> | Date | Rating |
> +---------+--------+
> | 2008-06 | 5 |
> | 2008-07 | 6 |
> | 2008-08 | 8 |
> | 2008-09 | 0 |
> | 2008-10 | 2 |
> | 2008-11 | 6 |
> +---------+--------+
>
> instead of like this:
>
> +---------+--------+
> |Date |Rating |
> +---------+--------+
> |2008-06 |5 |
> |2008-07 |6 |
> |2008-08 |8 |
> |2008-09 |0 |
> |2008-10 |2 |
> |2008-11 |6 |
> +---------+--------+
>
> - I'd replace the second two parameters of the constructor with an options
> hash, which allows you to set values for separation, decorator, and padding.
> For example,
>
> $options = array(
> 'separation' => 'header',
> 'decorator' => 'Ascii',
> 'padding' => 1
> );
> $table = new Zend_Text_Table(array(9, 8), $options);
>
> as opposed to:
>
> $table = new Zend_Text_Table(array(9, 8),
> Zend_Text_Table::AUTO_SEPARATE_HEADER,
> new Zend_Text_Table_Decorator_Ascii());
>
> - There should also be mutator methods for each of these options (i.e.,
> setSeparation(), setDecorator(), and setPadding()).
>
> - In keeping with other areas of the framework, I should be able to pass in
> the strings 'Ascii', 'Unicode', or 'My_Text_Table_Decorator_Whatever' as the
> value for the decorator, in addition to an actual object. The common use
> case is switching to 'Ascii', and having to type "new
> Zend_Text_Table_Decorator_Ascii()" is a bit sadistic. :-) I recommend
> using Zend_Loader_PluginLoader for this.
>
> - It's a simple component, but it needs more documentation than it
> currently has (with more code examples). You have nothing about separation
> or decorators, for example.
>
> I think the options hash for the constructor is the most important of these
> in the short term, because changing it in the future will be a BC break,
> whereas the others are improvements. Second on my wishlist would be
> padding. If you would like some help to get them done before the deadline,
> contact me off list and I'd be happy to lend a hand.
>
> Other than those few things, I think this is a great component. Good job,
> Ben!
>
> -Matt
>
>
> On Mon, Nov 10, 2008 at 8:21 AM, SiCo007 <[EMAIL PROTECTED]> wrote:
>
>>
>> Sounds interesting, but how do I view (or where!) the manual on this?
>>
>> It would be quite useful if you linked to the proposal when you announce
>> new
>> promotions as well (mainly because I'm lazy mind you!).
>>
>> Thanks
>>
>> -----
>> Simon
>>
>> http://www.ajb007.co.uk/
>> --
>> View this message in context:
>> http://www.nabble.com/Zend_Text_Table-promted-to-trunk-tp20422990p20423067.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>