Author Topic: Webpage to display live data from TD...  (Read 1945 times)

a15995

  • Newbie
  • *
  • Posts: 11
    • View Profile
Webpage to display live data from TD...
« on: October 14, 2015, 09:15:49 AM »
Has anyone managed to make a script that receives tournament data via GET or POST and displays that information on a webpage?

I'm thinking about making a page that just stores the GET/POST data in a database and displays the data as HTML when no GET/POST is received. I can do that but given the many variables TD has to offer it seems quite complex...

But if someone already has a template (ASP/VB) to do this, I'm very interested.

Thanks,
Søren

Mesnik44

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Webpage to display live data from TD...
« Reply #1 on: October 15, 2015, 10:58:37 AM »
I do.

You are more than welcome to all of my files!

http://mobile.hitmenpoker.com
« Last Edit: October 15, 2015, 11:01:37 AM by Mesnik44 »

a15995

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Webpage to display live data from TD...
« Reply #2 on: October 15, 2015, 01:37:22 PM »
Hi Mesnik44!

Thanks, that's great!

To which file do you send the data from TD - I seem to get "Failed" when I send to statusListener.php ...?

Thanks,
Søren

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5379
    • View Profile
Re: Webpage to display live data from TD...
« Reply #3 on: October 15, 2015, 04:19:49 PM »
FYI, the software includes example files in the folder named (oddly enough) examples.  That would be where the TD is installed, usually C:\Program Files (x86)\The Tournament Director 3\examples.

The TD should point to statusListener.php or statusListener.asp, depending on what your web site supports (PHP or ASP).

One thing to point out: the statusListener file will attempt to write the status data it receives from the TD to a file in the same folder in which statusListener is.  It is common that this is not allowed, due to file system permissions.  You can either adjust the permissions on that folder to allow it, or modify statusListener.php (or statusListener.asp) and TournamentStatus.js such that they use a different path where permissions are different (many sites will have a tmp folder to which data can be written).

a15995

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Webpage to display live data from TD...
« Reply #4 on: October 15, 2015, 06:21:01 PM »
Hi Corey!

I don't know if it is obvious that the example folder would contain a script for the "online" part of TD, but I see now (when I know what it is for) that it contains the same example.

In order to write the text file I had to modify some of the script "statusListener.asp" from this:

Code: [Select]
try
{
  theRef = new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(kFileOutput, true, false);
  theRef.Write(theOutput.join("\n"));
}

...to this:

Code: [Select]
try
{
  var objFS = Server.CreateObject("Scripting.FilesystemObject");
  theRef = Server.MapPath(kFileOutput);
  var objFile = objFS.CreateTextFile(theRef, true, false);
  objFile.Write(theOutput.join("\n"));
}

Now it works (the code may not be smooth but anyways) and I have no problem writing the file "tdstatus.txt" in the same folder...

Thanks both of you!  :D

/Søren
« Last Edit: October 15, 2015, 06:47:47 PM by a15995 »

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5379
    • View Profile
Re: Webpage to display live data from TD...
« Reply #5 on: October 16, 2015, 04:05:49 PM »
Glad you got it to work. 

That actually makes a lot of sense.   I think I'll update the example code with your addition.  Thanks!

a15995

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Webpage to display live data from TD...
« Reply #6 on: October 22, 2015, 04:37:40 PM »
Hmm I'm back and I seem to have found a small bug in the "TournamentStatus.js"-file which I believe should be updated in the example.

The code reads this:

Code: [Select]
 $("#ante").css({ display: TDStatus.HideZeroAnte ? "none" : "" });
  $("#label_ante").css({ display: TDStatus.HideZeroAnte ? "none" : "" });
  $("#space_ante").css({ display: TDStatus.HideZeroAnte ? "none" : "" });

But this only takes into consideration whether you have set HideZeroAnte to true/false - NOT considering if the actual ante is in fact zero.

I think the code should be updated to:

Code: [Select]
 $("#ante").css({ display: !TDStatus.HideZeroAnte ? "" : TDStatus.getChipsString(TDStatus.Vars["ante"]) == 0 ? "none" : "" });
  $("#label_ante").css({ display: !TDStatus.HideZeroAnte ? "" : TDStatus.getChipsString(TDStatus.Vars["ante"]) == 0 ? "none" : "" });
  $("#space_ante").css({ display: !TDStatus.HideZeroAnte ? "" : TDStatus.getChipsString(TDStatus.Vars["ante"]) == 0 ? "none" : "" });

Anyway, I have done the above and now the ante shows correctly, when there's something to show (HideZeroAnte = true)...

/Søren

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5379
    • View Profile
Re: Webpage to display live data from TD...
« Reply #7 on: October 26, 2015, 12:01:25 PM »
Yikes! You're absolutely right.  That was a big brain fart.  :)

Thanks for pointing this out.  I'll get it updated.