|
PITS /
01042Summary: Implementation of
$TableRowAttrFmt is inconsistent in coloring even/odd rowsCreated: 2008-08-28 14:32
Status: Open
Category: Bug
Assigned:
Priority: 2
Version: 2.2.0-beta65
OS: OS: RHEL ES 4.0/Apache 2.0.52/PHP 4.3.9
Description: Implementation of Reference recipe: FormattingTables Recipe excerpt: an administrator might choose to give each row a unique class attribute by row number: This code functions correctly as far as alternating row color is concerned, but does not preserve cosmetics in a special case. When a table has an odd number of rows the even/odd row coloring will switch for subsequent tables on the same page. For short tables this is actually quite an eyesore because row 1 will visually clash with the header row. This problem is due to loose management of the static variable $rowcount, in function FormatTableRow, file pmwiki.php, which maintains the even/odd row state across function calls. Small changes to two files in the wiki core corrected this issue at my site:
$ diff pmwiki.php.orig pmwiki.php
1339c1339
< function FormatTableRow($x, $sep = '\\|\\|') {
---
> function FormatTableRow($x, $sep = '\\|\\|', $reset_count = false) {
1342a1343,1346
> if ($reset_count) {
> $rowcount = 0;
> return '';
> }
$ diff stdmarkup.php.orig stdmarkup.php 375c375 < .'<:block,1>'"); --- > .'<:block,1>'.FormatTableRow(0,0,true)"); |