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
Switch to threaded view of this topic Create a new topic Submit Reply
FUDcode to PHP callback [message #30733] Sat, 11 March 2006 17:17 Go to next message
djechelon is currently offline  djechelon   Italy
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 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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
Re: FUDcode to PHP callback [message #30755 is a reply to message #30745] Sun, 12 March 2006 19:45 Go to previous messageGo to next message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
I don't exclude such solution...
But I don't know which PHP file in src directory is used when a topic is displayed. If you tell me, I'll be able to take a look at that...
Re: FUDcode to PHP callback [message #30790 is a reply to message #30755] Mon, 13 March 2006 14:25 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The fudcode implementation is found inside post_proc.inc.t file.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
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:30:22 GMT 2024

Total time taken to generate the page: 0.02905 seconds