by (OoR-F)~f*ckfish aka Alexander P.
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.
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
- Just added a parameter to be able strip the colors when using the image draw function
- Xymph beautified the code and enhanced the functionality of the DataFetcher, so I included his final version here. Thanks =)
- 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
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.
Implements every tag except the shadow tag because there is no css feature doing something similar at the moment.
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).
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>"; ?>
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.