I gave you simplest way without including any file. Just Add that div in html template file, let say {%right_content%} with all necessary css/JS. Then add this line to replace with contents of the database
<?php
$layout = new HTemplate("layout.tpl");
$layout->set("right_content", getContentRight($id));
echo $layout->render();
?>
So what is wrong with this?