vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




phpinclude

realwx
01-30-2007, 10:55 AM
How do I do a PHP script inside a template, e.g. the forum description? I'm an expert at PHP scripting however I'm new to vBulletin plugins. What I'm trying to do is this:

$template = '%stock%: <b>%price%</b> (%change%)';

function stocks($template, $stock) {
$data = file_get_contents("http://download.finance.yahoo.com/d/quotes.csv?s=$stock&f=sl1d1t1c1ohgv&e=.csv");
$data = explode(",", $data);
$current = round($data[1], 2);
$up = round($data[4], 2);
$template = str_replace("%stock%",$stock, $template);
$template = str_replace("%price%",$current, $template);
$template = str_replace("%change%", $up, $template);
return $template;
}

//vb would call "stocks($template, "AAPL")"


And then the forum description would input as:
The forum for all stock market talk! Apple stock info: $stocks
and translate it into:
The forum for all stock market talk! Apple stock info: AAPL: $88.88 (+8.88)
Where $stocks would be stocks($template, "AAPL").

Can somebody please help me out with this?

EDIT: Sorry, accidentally put in wrong forum. :o

Joeychgo
01-30-2007, 11:32 AM
I think you have to wrap it in PHP tags -- But im not a coder...

realwx
01-30-2007, 05:33 PM
Well, I've heard that there's a phpinclude... but I can't find it anywhere...

Joeychgo
01-31-2007, 01:00 AM
not that I recall - might be a file called that though -


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum