[PHP/HTML] TMN Color Parser and Data Fetcher

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

[PHP/HTML] TMN Color Parser and Data Fetcher

Post by f*ckfish » 23 Jul 2007 11:57

TMN Color Parser and Data Fetcher v0.5 (for PHP)
by (OoR-F)~f*ckfish aka Alexander P.
http://fish.stabb.de

These are two little classes that really come in handy if you try to create TMN related statistic pages. The usage of classes helps to hold your own sourcecode short and you don't have to care how they work, just include and use them as seen in the example below.

Download

NOTE: There's an updated version of the Color Parser taking care of the new Forever tags (TMF Color Parser)

TMN Color Parser and Data Fetcher All Versions
Download includes fully working usage examples

Update v1.2
  • Just added a parameter to be able strip the colors when using the image draw function
Update v1.1
  • Xymph beautified the code and enhanced the functionality of the DataFetcher, so I included his final version here. Thanks =)
Update v1.0
  • Fixed a lot of bugs in the ColorParser, be sure to check out the new version (removed problems with whitespaces and some weird other stuff that occured)
  • Now one file for all php versions
The Color Parser

This class converts TMN Strings to valid HTML and preserves styles and colors.
I'm aware of the mass of scripts available that convert color and style coded TMN Strings to HTML but my parser has a few other features. At first it also implements the $n-Tag by changing the letter spacing and font size, haven't seen that in another script before. Another nice feature is the ability to easily render the string onto on an image like a signature for example.

HTML

Implements every tag except the shadow tag because there is no css feature doing something similar at the moment.

Image

Implements the wide, italic and of course the color tags. I'll implement more, if I find the time for that ;-)
See it in action in the example below

The Data Fetcher

This class takes a TMN login, automatically gathers information from the known Nadeo sites and provides them in an easy-to-understand manner (see Example).

Example

This example shows the simplicity of the usage of the classes:

Code: Select all

<?
     //include classes
     require_once('./classes/TMNDataFetcher.php');
     require_once('./classes/ColorParser.php');

     //instantiate classes, the rest will be done automatically
     $data = new TMNDataFetcher('gluexxxkeks', true);
     $cp= new ColorParser();

     //output the desired information
     echo $data->login."<br>".
          $cp->toHTML($data->nickname)."<br>".
          $data->worldrank."<br>";
?>
This example simply puts out the login "gluexxxkeks", the correctly HTML color coded nickname and the worldrank. See all the information the Data Fetcher gathers in the screenshot below.

Screenshot

I only captured my local browser but you can also click here for a realtime preview ;-)
Also don't care for the login on the screen, I just searched for a login colored nickname that was in a team and online at the moment.
The background behind the nick is only to show that there is an image, you can render it on everything, maybe a prepared signature background or whatever...
This screen shows all the information the Data Fetcher gathers and also the functionality of the Color Parser to render to HTML and images.

Image
Last edited by f*ckfish on 10 Mar 2008 19:09, edited 8 times in total.
inactive, sorry

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by f*ckfish » 12 Aug 2007 12:09

The download link changed, see my first post.

Bye,
Fish
inactive, sorry

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by f*ckfish » 18 Aug 2007 09:17

Since the original version was buggy as hell I threw in a little update (see first post). If you are already using this tool you should definetly consider to update, there were some very stupid bugs in the source :oops:
inactive, sorry

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by f*ckfish » 02 Mar 2008 21:03

I finally managed to include Xymphs enhanced version of the DataFetcher. Thanks a lot for your work :D
inactive, sorry

Xymph
Pit Crew
Pit Crew
Posts: 5648
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by Xymph » 02 Mar 2008 23:08

Yowza. :lol: You're welcome.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by f*ckfish » 10 Mar 2008 19:20

By request I added a parameter to be able strip the colors when using the image draw function .
Download link as always in the first post.
inactive, sorry

PsyZo
highway camper
highway camper
Posts: 4
Joined: 26 Jun 2008 06:05
Owned TM-games: TMS, TMN, TMU, TMUF
Location: Nürnberg, Germany

Error in Data Fetcher

Post by PsyZo » 26 Jun 2008 06:32

Hi,
thanx for your work, but I get an error in TMNDataFetcher class:

In method getData() the first file_get_contens() return this:

Code: Select all

Array
(
    [0] => 5
    [1] => 

NOTICE in line 28 of file /home/scripts/game_Host_new/GetPlayerInfos.php

Aborting...


)
the second this:

Code: Select all

Array
(
    [0] => 12
    [1] => 
)
The first file_get_contents use this parameter:

Code: Select all

http://game.trackmanianations.com/online_game/getplayerinfos.php?ver=0.1.7.9&lang=en&login=MyLogin
the second this:

Code: Select all

http://ladder.trackmanianations.com/ladder/getstats.php?ver=0.1.7.9&laddertype=g&login=MyLogin
These are not the stats, or :wink: ? Can smb help me, please?

User avatar
f*ckfish
Pit Crew
Pit Crew
Posts: 1302
Joined: 15 Jun 2007 07:59
Owned TM-games: TMNF, TMUF
Location: Dresden, Germany
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by f*ckfish » 26 Jun 2008 06:39

Yepp, your login is not a valid TMN login. That's where the errors come from.
inactive, sorry

PsyZo
highway camper
highway camper
Posts: 4
Joined: 26 Jun 2008 06:05
Owned TM-games: TMS, TMN, TMU, TMUF
Location: Nürnberg, Germany

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by PsyZo » 26 Jun 2008 07:02

Thank you for your very quick answer.
I'm a little bit confused now :? , i've tried with many TMNF accounts, always the same error.

Is there a different between TMN and TMNF accounts? Do only TMN accounts work?

User avatar
Shaigan
happy cruiser
happy cruiser
Posts: 118
Joined: 06 May 2008 10:56
Owned TM-games: TMN, TMU, TMUF
Manialink(s): :shaigan
Location: Tarbes, FR
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by Shaigan » 26 Jun 2008 09:04

Yes, only old united or nations accounts, and not united forever nor nations forever accounts...

PsyZo
highway camper
highway camper
Posts: 4
Joined: 26 Jun 2008 06:05
Owned TM-games: TMS, TMN, TMU, TMUF
Location: Nürnberg, Germany

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by PsyZo » 26 Jun 2008 09:35

Shaigan wrote:Yes, only old united or nations accounts, and not united forever nor nations forever accounts...
Thx. That isn't good.
So is there a way to get informations with TMUF/TMNF accounts?

User avatar
Shaigan
happy cruiser
happy cruiser
Posts: 118
Joined: 06 May 2008 10:56
Owned TM-games: TMN, TMU, TMUF
Manialink(s): :shaigan
Location: Tarbes, FR
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by Shaigan » 26 Jun 2008 10:54

Wait tm-ladder.free.fr come back, the API should follow.

PsyZo
highway camper
highway camper
Posts: 4
Joined: 26 Jun 2008 06:05
Owned TM-games: TMS, TMN, TMU, TMUF
Location: Nürnberg, Germany

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by PsyZo » 26 Jun 2008 11:27

thanks a lot, i'll be waiting

[SA.fr] Tybos
cyclist
cyclist
Posts: 45
Joined: 19 Jun 2008 11:06
Owned TM-games: TMU, TMUF

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by [SA.fr] Tybos » 26 Jun 2008 11:30

Hi,

I am using the Color Parser class to print TMUF map names. Since Nadeo introduced new name features (and especially the $o one : bold text with semi-large spacing), the printing of some map names is "polluted" with "o"s.
Can we imagine to add this feature in Color Parser ?

Anyway, thank you very much for these very useful classes.

Tybos

EDIT : I apologize, I think I found what I needed here.
Nice work, thanks.
[SA.fr] TyBos

User avatar
hal|Sascha
Pit Crew
Pit Crew
Posts: 671
Joined: 12 Aug 2005 16:22
Owned TM-games: TMU, TMN, TMS, TMO
Location: Germany Munich
Contact:

Re: [PHP/HTML] TMN Color Parser and Data Fetcher

Post by hal|Sascha » 04 Jul 2008 06:41

I'm using the colorparser for the hal-ko replaydatabase and it works great! Nice work :thumbsup:
CPU: Intel Core 2 Duo E6600
Mainboard: Asus P5W DH Deluxe
RAM: 2 GB
Graphics: ATI Radeon X1950XTX
Audio: Soundblaster Audigy 4
Internet: ADSL 6Mbit
OS: Windows Vista Bussiness

Post Reply