PHP function to handle nickname colors/formatting?
- slugish
- Posts: 125
- Joined: 10 Jul 2012, 04:30
- Location: United States | Kentucky | Somerset
- Contact:
PHP function to handle nickname colors/formatting?
I am working on a script to display players in my servers on my site. I want to display players by nickname, but am stuck with converting names. I would prefer to display nicks using the same color and formatting rules as maniaplanet, but I would settle for a function to strip away formatting and display standard text. I am by no means a php pro, so I would love to avoid coding this from scratch if someone else has already done so. Does anyone have this already?
-
- Translator
- Posts: 185
- Joined: 15 Jun 2010, 11:14
- Location: Czech republic » Jihomoravský kraj » Břeclav
- Contact:
Re: PHP function to handle nickname colors/formatting?
This is still exist and is compatible with MP
http://fish.stabb.de/index.php5?page=do ... ubpage=127
http://fish.stabb.de/index.php5?page=do ... ubpage=127
-
- Posts: 1026
- Joined: 15 Jun 2010, 15:46
Re: PHP function to handle nickname colors/formatting?
You can also check out our ManiaLib classes which we're using in all our projects.
- Formatting: to strip colors, links and other formatting from the string
- StyleParser: a full rework of class given in previous post, which handles formatting as closest to the game as possible and correct a few bugs. You can see the result on the player page for instance.
- Color: mandatory for these classes to work, used to contrast colors.
- Formatting: to strip colors, links and other formatting from the string
- StyleParser: a full rework of class given in previous post, which handles formatting as closest to the game as possible and correct a few bugs. You can see the result on the player page for instance.
- Color: mandatory for these classes to work, used to contrast colors.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
- slugish
- Posts: 125
- Joined: 10 Jul 2012, 04:30
- Location: United States | Kentucky | Somerset
- Contact:
Re: PHP function to handle nickname colors/formatting?
Sweet... that should be able to handle what I need. Thanks!
Now, this actually confuses me somewhat... What is the difference between Manialib and Maniaplanet Web Services?
Now, this actually confuses me somewhat... What is the difference between Manialib and Maniaplanet Web Services?
-
- Posts: 1026
- Joined: 15 Jun 2010, 15:46
Re: PHP function to handle nickname colors/formatting?
ManiaLib is a lightweight framework to create Manialinks (and web pages) following MVC paradigm, like Zend or Symfony (to take PHP examples).
Maniaplanet Web Services are, well, web services ^^ So they are only useful to request data about players, rankings, ... to send notifications, to make transactions and this kind of thing but it won't handle any UI at all.
Maniaplanet Web Services are, well, web services ^^ So they are only useful to request data about players, rankings, ... to send notifications, to make transactions and this kind of thing but it won't handle any UI at all.
OS: Win 7 Pro x64
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
RAM: 2x4GB Corsair @ 1600MHz
CPU: Intel i5 760 @ 3.6GHz
Mobo: Asus P7P55D-E
GPU: NVidia GTX 760 2GB
HDD: WD Black 1TB
Sound: VIA VT1828S (onboard)
Peripherals: Razer DeathAdder - Razer DeathStalker - Logitech F310
Re: PHP function to handle nickname colors/formatting?
You can also use JavaScript to parse maniaplanet style.
Take a look at http://magnetik.github.com/maniaplanet-style-js-parser/
it's far from being perfect but still quite usable.
I'll publish a jQuery plugin to make the use easier during the week.
Take a look at http://magnetik.github.com/maniaplanet-style-js-parser/
it's far from being perfect but still quite usable.
I'll publish a jQuery plugin to make the use easier during the week.
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
- slugish
- Posts: 125
- Joined: 10 Jul 2012, 04:30
- Location: United States | Kentucky | Somerset
- Contact:
Re: PHP function to handle nickname colors/formatting?
Edit: Okay, so the below was after I had tested the script as simply a php file. If I open that file, the below is what shows up. However, if I embed that file in an iframe on my wordpress site, the unicode displays correctly. I have no idea how or why that works, but apparently I have it working now...RamCUP2000 wrote:This is still exist and is compatible with MP
http://fish.stabb.de/index.php5?page=do ... ubpage=127
I have this working and it handles the colors/formatting great, but it appears to have some trouble with alt code/unicode. Is this an issue with the script, or is this perhaps related to the server I have it running on? Here is an example, I am using the script to parse both the server name and player names. The bottom right corner is an overlay of the page that I have the script running on.

Re: PHP function to handle nickname colors/formatting?
Your output page need to encode UTF-8 to show special characters
This should do the trick.
This should do the trick.
Code: Select all
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

Re: PHP function to handle nickname colors/formatting?
Don't forget to write your file with utf8 character encoding, in case you want to display some special chars too.
This is possible with an editor like notepad++ (Menu: "Encoding"=>Convert to UTF-8).
Player list is already in UTF8 and will be displayed well with the line given by steppie.
Also I have a question in relation with this topic : Does Manialive include specifics fonts used in the game or should we use TAHOMA as usual with Tm ?
This is possible with an editor like notepad++ (Menu: "Encoding"=>Convert to UTF-8).
Player list is already in UTF8 and will be displayed well with the line given by steppie.
Also I have a question in relation with this topic : Does Manialive include specifics fonts used in the game or should we use TAHOMA as usual with Tm ?
Re: PHP function to handle nickname colors/formatting?
There are no font included.
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
Who is online
Users browsing this forum: No registered users and 1 guest