Create another php file called myscript.php for example, then insert into the TPL file where you want to see it the following:
{include_php file="myscript.php"}
That worked for me for a news system, a random image (not related to xcart) and a random quote system.
