FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » FUDcode to PHP callback
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
FUDcode to PHP callback [message #30733] Sat, 11 March 2006 17:17 Go to previous message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma:
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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: PDF Page Formatting
Next Topic: TREE VIEW not staying as default....it is always switching back to flat.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 07:36:46 GMT 2024

Total time taken to generate the page: 0.04240 seconds