.js injection by manipulating the DOM works, but i'd recommend just modifying showflat.inc.php plus a tpl or two to do the work.

you are more semantic at the server level and can pass the optional meta to smarty for output..

2c