Try this updated code:
/******************************************************************************
** Section <<<$template_cat_list>>> - START
******************************************************************************/
// HTML template for the category list
$template_cat_list = <<<EOT
<!-- BEGIN header -->
<tr>
<td class="tableh1" width="100%" align="left" colspan="3">{CATEGORY}</td>
</tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
<td class="catrow_noalb" align="left"><table border="0"><tr><td align="center">{CAT_THUMB}<span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
<td class="catrow" align="left"><table border="0"><tr><td align="center">{CAT_THUMB}<span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
<!-- END catrow -->
<!-- BEGIN footer -->
<tr>
<td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
</tr>
<!-- END footer -->
<!-- BEGIN spacer -->
<img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->
EOT;
/******************************************************************************
** Section <<<$template_cat_list>>> - END
******************************************************************************/
/******************************************************************************
** Section <<<theme_display_cat_list>>> - START
******************************************************************************/
function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
global $template_cat_list, $lang_cat_list;
if (count($cat_data) > 0) {
starttable('100%');
$template = template_extract_block($template_cat_list, 'header');
$params = array(
'{CATEGORY}' => $lang_cat_list['category'],
'{ALBUMS}' => $lang_cat_list['albums'],
'{PICTURES}' => $lang_cat_list['pictures'],
);
echo template_eval($template, $params);
}
$template_noalb = template_extract_block($template_cat_list, 'catrow_noalb');
$template = template_extract_block($template_cat_list, 'catrow');
$cols = 3;
$count = 0;
echo "<tr>";
foreach($cat_data as $category) {
if ($count%$cols == 0) {
echo "</tr><tr>";
}
$count++;
if (!isset($category['cat_thumb'])) { $category['cat_thumb'] = ''; }
if (count($category) == 3) {
$params = array(
'{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
);
$cell = template_eval($template_noalb, $params);
} elseif (isset($category['cat_albums']) && ($category['cat_albums'] != '')) {
$params = array(
'{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{CAT_ALBUMS}' => $category['cat_albums'],
'{ALB_COUNT}' => cpg_float2decimal($category[2]),
'{PIC_COUNT}' => cpg_float2decimal($category[3]),
);
$cell = template_eval($template, $params);
} else {
$params = array(
'{CAT_TITLE}' => $category[0],
'{CAT_THUMB}' => $category['cat_thumb'],
'{CAT_DESC}' => $category[1],
'{CAT_ALBUMS}' => '',
'{ALB_COUNT}' => cpg_float2decimal($category[2]),
'{PIC_COUNT}' => cpg_float2decimal($category[3]),
);
$cell = template_eval($template, $params);
}
if (!strpos($category['cat_thumb'], '<img src="images/spacer.gif"')) {
$cell = str_replace('<td class', '<td colspan="'.$cols.'" class', $cell);
echo $cell;
echo "</tr><tr>";
$count = 0;
} else {
echo $cell;
}
}
while ($count++%$cols != 0) {
echo "<td class=\"catrow_noalb\"></td>";
}
echo "</tr>";
if ($statistics && count($cat_data) > 0) {
$template = template_extract_block($template_cat_list, 'footer');
$params = array('{STATISTICS}' => $statistics);
echo template_eval($template, $params);
}
if (count($cat_data) > 0)
endtable();
echo template_extract_block($template_cat_list, 'spacer');
}
/******************************************************************************
** Section <<<theme_display_cat_list>>> - END
******************************************************************************/