[pmwiki-users] Table Problem -
Peter Davidoff
peter at tomatoad.com
Thu Aug 30 10:08:38 CDT 2007
Petko Yotov: The fix worked, thankyou.
Peter Gragert:
The version of pmwiki on the server is,
and the code for the function is: 2.1.11
>function FormatTableRow($x) {
> global $Block, $TableCellAttrFmt, $MarkupFrame, $TableRowAttrFmt,
> $TableRowIndexMax, $FmtV;
> static $rowcount;
> $x = preg_replace('/\\|\\|\\s*$/','',$x);
> $td = explode('||',$x); $y='';
> for($i=0;$i<count($td);$i++) {
> if ($td[$i]=='') continue;
> $FmtV['$TableCellCount'] = $i;
> $attr = FmtPageName($TableCellAttrFmt, '');
> $td[$i] = preg_replace('/^(!?)\\s+$/', '$1 ', $td[$i]);
> if (preg_match('/^!(.*?)!$/',$td[$i],$match))
> { $td[$i]=$match[1]; $t='caption'; $attr=''; }
> elseif (preg_match('/^!(.*)$/',$td[$i],$match))
> { $td[$i]=$match[1]; $t='th'; }
> else $t='td';
> if (preg_match('/^\\s.*\\s$/',$td[$i])) { $attr .= " align='center'"; }
> elseif (preg_match('/^\\s/',$td[$i])) { $attr .= " align='right'"; }
> elseif (preg_match('/\\s$/',$td[$i])) { $attr .= " align='left'"; }
> for ($colspan=1;$i+$colspan<count($td);$colspan++)
> if ($td[$colspan+$i]!='') break;
> if ($colspan>1) { $attr .= " colspan='$colspan'"; }
> $y .= "<$t $attr>".trim($td[$i])."</$t>";
> }
> if ($t=='caption') return "<:table,1>$y";
> if (@$MarkupFrame[0]['cs'][0] != 'table') $rowcount = 0; else $rowcount++;
> $FmtV['$TableRowCount'] = $rowcount + 1;
> $FmtV['$TableRowIndex'] = ($rowcount % $TableRowIndexMax) + 1;
> $trattr = FmtPageName($TableRowAttrFmt, '');
> return "<:table,1><tr $trattr>$y</tr>";
>}
----------------
>On Thursday 30 August 2007, Peter Davidoff wrote:
> > Warning: Division by zero in /home/u1/brendaw/html/pmwiki.php on line
> > 1070
> >
> > I've been looking through the table but I don't immediately see the
> > problem. Any thoughts on where to look?
>
>Yes, this bug appears in some versions of PHP (probably your hosting provider
>upgraded). The most probable case can be fixed by [1] :
>
>* either upgrade to the latest PmWiki stable or beta version,
>* or set in local/config.php or local/farmconfig.php the line:
>
> $TableRowIndexMax = 1;
>
>Thanks,
>Petko
>
>[1] http://www.pmwiki.org/wiki/PmWiki/Troubleshooting
More information about the pmwiki-users
mailing list