I've this function I produced to provide my wordpress site an appearance tag...

   function give_body_class( $print = true )
{
    global $wp_query;
    $c = "";

    // Generic semantic classes for what type of content is displayed

    is_archive()        ? $c = 'archive_page'       : null;
    is_date()           ? $c = 'date_page'          : null;
    is_search()         ? $c = 'search_page'        : null;
    is_paged()          ? $c = 'paged_page'         : null;
    is_tree(2)      ? $c = 'type_1'         : null;         
    is_tree(42)     ? $c = 'type_2'         : null;         
    is_tree(55)     ? $c = 'type_3'                 : null;             
    is_tree(57)     ? $c = 'type_4'                 : null;                 
    is_home()           ? $c = 'front'                  : null; 
    is_404()            ? $c = 'error_404'              : null; 

    return $print ? print($c) : $c;
}

I personally use this to print your body class title within the header and that's why I am telling it to print.

And i'm also trying make use of a logical statement on another page that is working, however I am unsure how you can stop it printing the variable.

e.g

<?php if (give_body_class('type_1')) { echo 'active'; } ?>

returns:

"type_1active"

Would you know very well what parameters the function takes ?? It's merely a boolean which determine whether it has to print the course or otherwise, just pass false not to print !

Just alter the last line to

return $c;