It is possible for $i to skip values in the output, so a strict mod 4 needs its own counter within the output section.
If the styles repeat, you don't want to use ids; they must be unique. But four repeating/rotating style classes are perfectly valid, as are multiple classes for an element.
There is a much simpler way of doing the repeat: using a mod 4 operation on the counter, then assigning the result as the suffix of the classname. $new_style already holds the classname, and it can hold two of them just as well.
PHP Code:
$modcount = 0; //initialize above loop
$new_style .= ' repeat_' . int(($modcount % 4) *4); // % is modulus operator
$modcount ++; //increment
This can go in tpl_categories.php below the if/else:
PHP Code:
$content = "";
$modcount = 0; //initialize above loop
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
for ($i=0;$i<sizeof($box_categories_array);$i++) {
switch(true) {
//...
default:
$new_style = 'category-products';
}
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
$new_style .= ' repeat_' . int(($modcount % 4) *4); // % is modulus operator
$modcount ++; //increment
$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
This will make $new_style equal to 'category-top repeat_0' or whatever the particular values are.