PHP HELP - Using A Variable In Tpl Or Html Block »  Show posts from    to     

Icy Phoenix


Old Support Topics - PHP HELP - Using A Variable In Tpl Or Html Block



Vortex [ Thu 11 Oct, 2007 10:58 ]
Post subject: PHP HELP - Using A Variable In Tpl Or Html Block
Hi all, I need a little help with a customization of my site.

For my community, I have an IRC channel hosted by azzurra.org. I'd like to put a block in home page (or global) which indicates the number of users in chat at that moment.


Azzurra provides me a script to do so: http://www.azzurra.org/scripts/forumfree.php?chan=MYCHANNEL


This script just prints in plain text a number.



Now, I'd like to put a script on my page that can take that number and put it on a variable, and use that variable to show something like "Chat ( n° )" in top menu overall_header.tpl (like the new posts function) or in an html block...


Can anybody help me with this?


Vortex [ Sun 21 Oct, 2007 18:30 ]
Post subject: Re: PHP HELP - Using A Variable In Tpl Or Html Block
Solved with this:


Code: [Hide] [Select]
<?php

function chat_users(){
$remote = "http://www.azzurra.org/scripts/forumfree.php?chan=MYCHANNEL" ;
$read = fopen($remote, 'r');
while (false !== ($num = fgetc($read))) {
$chat_users = $num;

echo "$chat_users";
}
}

chat_users();

?>




Powered by Icy Phoenix