This should work fine:
PHP Code:
function findtemplate($templatename) {
$gettemp = mysql_query("SELECT template FROM template WHERE title='".addslashes($templatename)."' LIMIT 1") or die(mysql_error());
$tmp = mysql_fetch_array($gettemp);
$tmp = addslashes($tmp);
$tmp = str_replace("\\'","'",$tmp);
return $tmp;
}
Store as variable:
PHP Code:
eval("\$template= \"".findtemplate('homepage')."\";");
Or output directly:
PHP Code:
echo findtemplate('homepage');