Evidently something went wrong while making the PHP changes... hmm
-- Contemplative expression --
Next thing I'd try is starting afresh.
- Delete palmthread.php, make a copy of printthread.php
- Run the link without any PHP changes. It should look identical to the printer-friendly version (duh!)
- Then make the template changes, testing after each change. (The text displayed will look progressively uglier)
- Finally, the last output change.
Let me know where it croaks!