PDA

View Full Version : Request - Stock Quotes in Header


scottct1
05-10-2004, 12:36 PM
Hi there,

I have noticed that a few phpBB sites have company stock quotes listed in their headers (check out http://www.xmfan.com and http://www.xm411.com for examples)

I want to do the same thing on my site with vBulletin 3.

Any ideas how I can do this?

I believe they are pulling the info from Yahoo.

Thanks for anyone who can help!

scottct1
05-10-2004, 04:27 PM
Ok I have been able to figure it out a little bit...

Here is what I got so far...

If I put the following code in a PHP file the stock quotes will display, but only at the top of the page.

$fd = fopen ("http://quote.yahoo.com/d/quotes.csv?s=DISH&f=sl1d1t1c1ohgv&e=.csv", "r");
$contents = fread ($fd, 200);
fclose ($fd);

$contents = str_replace ("\"", "", $contents);
$contents = explode (",", $contents);

echo "<ul><li>DISH Network stock tracker. Most recent trade: <b>\$$contents[1]</b>. ($contents[4]) (Prices delayed up to 20 minutes.)</li>";


Again this code works however the data is displayed at the top of my page.

I would like to be able to take this data and the

<ul><li>DISH Network stock tracker. Most recent trade: <b>\$$contents[1]</b>. ($contents[4]) (Prices delayed up to 20 minutes.)</li>

and put it into my templates, so the stock is displayed exactly where I want it on the page not at the top of the page. I would like it to go in my header, below my logo and above the Navbar.

Any ideas?

scottct1
05-10-2004, 07:06 PM
Can anyone help? I would really like this displayed in my templates and not at the top of my page.

Check out http://www.satelliteguys.us/index.php to see what I mean.

Thanks!

scottct1
05-11-2004, 01:22 PM
Can anyone PLEASE help?

ponche
05-11-2004, 01:41 PM
Where did you put your additions? Try putting your code where you want the information to be displayed?

-Kevin

scottct1
05-11-2004, 03:54 PM
Right now the code is in my index.php file.

The problem with this is no matter where I put the PHP in the file it still displays above the top and above the <html> & <body> when it is displayed to the user.

I want to be able to put this in my header template below my logo.