Hey,
great solution!
I might misunderstand your code, marathoner, but I think there is a tiny error in it.
In
<div id="content">
<?php if ($content2<>"") { // Next test $content2 to see if there is something in it
echo "<div id=\"content1\">\n";
}?>
shouldn't it be instead
<div id="content">
<?php if ($content1<>"") { // Next test $content1 to see if there is something in it
echo "<div id=\"content1\">\n";
}?>
?