PDA

View Full Version : I need some help with using vb templates in my hack


YellowKard
03-20-2001, 11:37 PM
I was wondering how I could use a vb template called quotereply_quotes instead of an external .txt file for the following code:

$quotefilepath = "quotes.txt";

function randomline($filename) {
$file = file($filename);
srand((double)microtime()*1000000);
while ($randomquote == "") {
$randomquote = ereg_replace("\n","",$file[rand(0,count($file))]);
}
return $randomquote;
}

$quote = randomline("$quotefilepath");I had to use [ code ] and not [ php ] because [ php ] stripped my code's slashes.

03-21-2001, 01:20 AM
you can't put codes in a template. all php codes have to go in php files.

03-21-2001, 02:35 AM
I know that, that's not what I'm asking, the code goes in newreply.php.

My question is how do I get my data from a template instead of an external ascii file (.txt file)?

03-21-2001, 04:49 AM
require("global.php");
eval("dooutput(\"".gettemplate('templatename')."\");");

:)