Implement “No related posts for this entry” into the loop?

I still can’t see how the code and the problem is substantially different from your original topic;

however, try to add your text into the typical ‘else’ location for a loop if no posts are found;
change this line:

<?php 
endwhile; endif; 
?>

to:

<?php 
endwhile; 
else :
echo '<h3 class="no-related-posts">sorry but there are no related posts for this entry</h3>';
endif; 
?> 

the css class is provided to make selective styling of the text easier.

edit:

the above is for the case if the post does have tags, but if there are no related posts with the same tag. it needs to stay in place.

in addition, there should be a message, when there are no tags;
change this line:

<?php } // end if($tags) ?>   

to:

<?php } else { //if no tags, show message
echo '<h3 class="no-related-posts">sorry but there are no related posts for this entry</h3>';
} // end if($tags) 
?>