Итак, есть код js и php
$(document).ready(function(){
$('.category').on('change', function(){
var category_list = [];
$('#filters :input:checked').each(function(){
var category = $(this).val();
category_list.push(category);
});
if(category_list.length == 0)
$('.resultblock').fadeIn();
else {
$('.resultblock').each(function(){
var item = $(this).attr('data-tag');
if(jQuery.inArray(item,category_list) > -1)
$(this).fadeIn('slow');
else
$(this).hide();
});
}
});
});
//он скрывает и показывает tr
while ( $show = mysql_fetch_array($sql)) {
if($show['cover_rf'] != 0){
echo '<tr class="resultblock" data-tag="game">';
echo '<td><form action="" method="post" class="send-id-form"><input type="submit" name="edit_now" value="Редактироать" class="submit-id"><input type="hidden" name="id_edit_now" value="'.$show['id'].'"></form><form action="" method="POST" class="send-id-delete"><input type="submit" name="delete_now" value="Удалить"><input type="hidden" name="id_delete_now" value="'.$show['id'].'"></form></td>';
echo '<td> <a href="http://'.$show['Link'].'" target="_blank">'.$show['Name'].'</a></td>';
echo '<td> <p class="desc_text">'.$cover[$show['cover_rf']].'</p></td>';
echo '<td> <p>'.$aud[$show['aud_kids']].' '.$aud[$show['aud_young']].' '.$aud[$show['aud_buis']].' '.$aud[$show['aud_par']].''.$aud[$show['aud_teach']].'</p></td>';
echo '<td> <p>'.$areas[$show['direct_educ']].' '.$areas[$show['direct_prof']].' '.$areas[$show['direct_carer']].' '.$areas[$show['direct_psy']].' '.$areas[$show['direct_buis']].' '.$areas[$show['direct_soc']].'</p></td>';
echo '<td> <p>'.$carer[$show['prof_info']].' '.$carer[$show['prof_art']].' '.$carer[$show['prof_games']].' '.$carer[$show['prof_diagnostics']].' '.$carer[$show['prof_teaching']].'</p></td>';
echo '</tr>';
}
}
//формирование таблицы tr
Суть вопроса: как можно обойтись без сотен условий, то есть не писать вот так каждый при добовлении дополнительного контента?
if($show['cover_rf'] != 0 && $show['cover_rt'] !=0){
echo '<tr class="resultblock" data-tag="game">';
echo '<td><form action="" method="post" class="send-id-form"><input type="submit" name="edit_now" value="Редактироать" class="submit-id"><input type="hidden" name="id_edit_now" value="'.$show['id'].'"></form><form action="" method="POST" class="send-id-delete"><input type="submit" name="delete_now" value="Удалить"><input type="hidden" name="id_delete_now" value="'.$show['id'].'"></form></td>';
echo '<td> <a href="http://'.$show['Link'].'" target="_blank">'.$show['Name'].'</a></td>';
echo '<td> <p class="desc_text">'.$cover[$show['cover_rf']].' '.$cover[$show['cover_rt']].' </p></td>';
echo '<td> <p>'.$aud[$show['aud_kids']].' '.$aud[$show['aud_young']].' '.$aud[$show['aud_buis']].' '.$aud[$show['aud_par']].''.$aud[$show['aud_teach']].'</p></td>';
echo '<td> <p>'.$areas[$show['direct_educ']].' '.$areas[$show['direct_prof']].' '.$areas[$show['direct_carer']].' '.$areas[$show['direct_psy']].' '.$areas[$show['direct_buis']].' '.$areas[$show['direct_soc']].'</p></td>';
echo '<td> <p>'.$carer[$show['prof_info']].' '.$carer[$show['prof_art']].' '.$carer[$show['prof_games']].' '.$carer[$show['prof_diagnostics']].' '.$carer[$show['prof_teaching']].'</p></td>';
echo '</tr>';
}
обратить внимание на $cover(строка)