Creating Tag Filters based on Cookbook

Do you mean like that?

if($tag = param('tag')) {
            $album = $album->filterBy('tags', $tag, ',');
            $classe ='inactive';
          }
   if( param('tag') === $tag ) {
            $classe ='active';
          }

that still gives me al tags as “active” =(