FUDcode to PHP callback [message #30733] |
Sat, 11 March 2006 17:17 |
djechelon
Messages: 46 Registered: July 2005
Karma: 0
|
Member |
|
|
Hi,
I need to implement a new feature on my FUDforum-powered board.
I have a BitTorrent Tracker and I want to display realtime Torrent info on files that are uploaded on my tracker.
I don't want to go down in details on how a Torrent is stored in the tracker's database (which is the same as FUDforum's). Let's only quickly say that each Torrent is identified by a hexadecimal hash code. I would like to implement something like
[torrent]aaaabb787ffac787a212[/torrent] tag inside the message
As I understood here, for performance reasons FUDcode is decoded at posting time and not at view time, storing HTML output on text file. This solution is not suitable for my needs, because I need realtime data on Torrents, such as how many people are downloading/uploading a Torrent and its total speed.
I thought about the solution mentioned in the subject: when FUDforum reads the topic text and encounters a [torrent] tag, it should call a user-defined function that simply returns an HTML representation of the Torrent data.
For example (hash codes are random):
[torrent]57fb120a4732[/torrent]
returns
Torrent
Name: SUSE LINUX 10.0 Community Edition
Size: 7.00GB Speed: 350KB/s
Seeders: 53 Leechers: 140
Download Tell A Friend
I thought about a way to do that.
First of all, I noticed that unrecognized tags are deleted. So if I change the tag using {torrent}, I could go edit the Forum's code. Something there should be something like
<?php echo $msg ?>
to show the message text. I could change that using preg_replace_callback function that replaces the pattern with the output of the callback function.
So I wonder which file and where I should edit, and if there's a better way to do what I said in this topic.
|
|
|
Re: FUDcode to PHP callback [message #30745 is a reply to message #30733] |
Sun, 12 March 2006 17:23 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You can convert the tag to javaScript or iframe and have it load/update the data real-time from another page.
FUDforum Core Developer
|
|
|
|
|