I'm posting this cause I searched and didn't find it. I read the documentation on Scribd linked from the Absolute Beginner's Guide. Because there was a bit to cut-and-paste, I downloaded the text version of it to grab the bit you stick in your template:
The problem is that the close php tag should be ?> not ? > - that space makes the whole thing broken, twice in this sample. If a beginner (say me!) actually cuts-and-pastes that into their template, the whole site goes fubar and you get an error. And the poor beginner freaks out completly as the whole entire site I've been building for weeks just disappears! Luckily, I just deleted that crap and it came back. Still this is very bad for something supposed to be for Absolute Beginner's, eh?
A secondary problem is that Joomla already has this built-in anyways, so you don't need all that crap in your template anyways. All you have to add after the DOCTYPE and HTML statements is:
<?php JHTML::_('behavior.modal'); %>
So the documentation is trying to go about it in an excessively complicated way (aside from being broken due to that space in the close php tag).
Posted not to complain about the documentation (I realize it's a freebie produced by a volunteer), but so the next person who Googles this problem finds this answer.