Skip to content

Instantly share code, notes, and snippets.

@ginsterbusch
Created May 16, 2013 08:39
Show Gist options
  • Save ginsterbusch/5590300 to your computer and use it in GitHub Desktop.
Save ginsterbusch/5590300 to your computer and use it in GitHub Desktop.
Capri Fishn bzw. im Trüben fischen ... Dinge, denen man so als Entwickler täglich begegnet. In anderer Leute Quelltext vor allen Dingen. Capri Fish - or: to stab in the dark .. Stuff you, as a developer, stumble upon daily, esp. in the source code committed by OTHER people.
function get_table_head( $col, $mode = 'desc' ) {
$return = '';
$link = '';
$amp = '&';
$equal = '=';
$link .= '?bereich='.$_GET['bereich'];
foreach($_GET as $key => $value){
if($value == "desc"){
$mode_return = "asc";
}else{
$mode_return = "desc";
}
if($key == 'sort' || $key == 'table'){
$key = '';
$value = '';
$equal = '';
$amp = '';
}
if($key != 'bereich') $link .= $amp.$key.$equal.$value;
}
foreach($col as $key => $value){
if($mode_return == 'desc'){
$modeClass = 'sort-desc';
}
else{
$modeClass = 'sort-asc';
}
$return .= '<th class="'.$modeClass.'"><a href="'.$link.'&table='.$key.'&sort='.$mode_return.'">'.strtoupper($value).'</a></th>';
}
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment