This may work for you as well without using PHx (although PHx is great if you do not know PHP)
Here's a slightly simpler (but less flexible) version:
Put this in your template where the longtitle would go:
[!LongTitle!]
Then create a snippet called LongTitle and paste in this code:
<?php
$field = $modx->documentObject['longtitle']
return empty($field)? "" : '<h1>'.$field.'</h1>';
?>
The last line is equivalent to this:
if (empty($field)) {
return "";
} else {
return '<h1>'.$field.'</h1>';
}
And here's another way using a placeholder (just to show how flexible MODx is):

In your template:
[!LongTitle!]
[+my_longtitle+]
In the snippet:
<?php
$field = $modx->documentObject['longtitle']
$modx->setPlaceholder('my_longtitle', empty($field)? "" : '<h1>'.$field.'</h1>');
?>
I hope this doesn't confuse you too much. Feel free to ask questions if you run into trouble.
