If ($somethingtrue) {
?>
html code goes here
<?
else {
exit();
}
I was wondering if I was allowed to do something like that, so instead of using echo to output html, I could write it directly.
yes, it's perfectly fine to do this.
Just note that you should not use short tags. Use <?php instead since short tags will be disabled from PHP 6.