function switch_tabs tabs active class active_class out total count ta

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
function switch_tabs($tabs, $active, $class, $active_class) {
$out = '';
$total = count($tabs);
foreach ($tabs as $id => $tab) {
$out .= '<a href="'.(!isset($tab[1]) ? '#' : $tab[1]).'" class="'.($active == $id ? $active_class : $class).'" tab-id="'.$id.'">'.$tab[0].'</a>';
if (--$total)
$out .= ' | ';
}
return $out;
}