Hjælp til tæller i funktion
Jeg har her en menu-funktion hvor jeg har indsat 2 hacks, da jeg ikke kan finde ud af at udarbejde en tæller til formålet på egen hånd. Håber derfor at der er en ekspert som kan hjælpe:Første hack skal ændres hvor "if($counter==22)" og erstattes med en tæller "if (det_er_første_omgang)"
Andet hack skal ændres hvor "if ($counter==24)" og erstattes med en tæller "if (det_er_sidste_omgang)"
function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;
// HACK
if ($counter==22) {
$categories_string .= '<ul class="categories"><li class="bg_list_un">';
for ($i=0; $i<$tree[$counter]['level']; $i++) {
$categories_string .= "<div>";
}
$categories_string .= '<a href="';
} else {
$categories_string .= '<li class="bg_list">';
for ($i=0; $i<$tree[$counter]['level']; $i++) {
$categories_string .= "<div>";
}
$categories_string .= '<a href="';
}
if ($tree[$counter]['parent'] == 0) {
$cPath_new = 'cPath=' . $counter;
} else {
$cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
if (isset($cPath_array) && in_array($counter, $cPath_array)) {
$categories_string .= '<b>';
}
// display category name
$categories_string .= $tree[$counter]['name'];
if (isset($cPath_array) && in_array($counter, $cPath_array)) {
$categories_string .= '</b>';
}
if (tep_has_category_subcategories($counter)) {
$categories_string .= ' »';
}
$categories_string .= '</a>';
for ($i=0; $i<$tree[$counter]['level']; $i++) {
$categories_string .= "</div>";
}
$categories_string .='</li>';
// HACK
if ($counter==24) { $categories_string .= '</ul>'; }
if (SHOW_COUNTS == 'true') {
$products_in_category = tep_count_products_in_category($counter);
if ($products_in_category > 0) {
$categories_string .= ' (' . $products_in_category . ')';
}
}
//$categories_string .= '<br>';
if ($tree[$counter]['next_id'] != false) {
tep_show_category($tree[$counter]['next_id']);
}
}
?>
