I have this... [code] function RandomNews(){ $query = mysql_query("SELECT * FROM tbl_news WHERE active='1' ORDER BY rand() LIMIT 0,1"); if (mysql_num_rows($query) == "1"){ $r = mysql_fetch_object($query); $id = $r->id; $title = $r->title; echo "<a href='view_news.php?id=$id'>$title</a>"; } } $news = RandomNews(); $tags = array('title'=>'Sparetime Recreation','news'=>$news); $tp->parseTemplate($tags); echo $tp->display();[/code] for some reason, when it parses the template, it puts the 'news' at the beginning of the parsed html. If i dont use the function RandomNews(); it works fine and puts it in the right place in the html... im confused. Help please. Thanks, Adam