View Full Version : Quick LFS host information on your site
Victor
13th October 2009, 17:03
Some time ago there was a request for a quick host-information feature that could be used on people's websites to display all information regarding a certain LFS host.
Because the information regarding the use of that feature got scattered all around a certain thread I thought it'd be good to create a separate sticky for it, detailing the usage :
LFS Host status feature
URL : http://www.lfsworld.net/hoststatus/?h=<HOSTNAME>
Eg. http://www.lfsworld.net/hoststatus/?h=Blackwood%20XFG%20XRG
This returns a full HTML page with header, body and footer. If you want only the body contents of the page, append &onlycontent to the url.
Hostname colour options : (add to url)
&c=1 for black
&c=2 for white
&c=3 for grey
&c=4 for blue
Turn the hostname in the result into an LFS Join link
&hostlink
Hostname URL encoding
If you want to use this feature for a host with weird characters in its name, you must "urlencode" the hostname, which means you must convert these weird characters into a format acceptable for use inside an URL. If you're having problems getting this feature to work because it keeps saying the host is offline, you may want to give the following a try.
To make it easy for you I've created a simple page where you can convert any text into urlencoded text : http://www.lfsworld.net/urlencode.html
Using custom CSS
If you want to use a custom CSS file for this feature then you can send your own CSS file to me (or post it here) and I will make it work for you and let you know how to use it.
----
Original host status thread : http://www.lfsforum.net/showthread.php?t=54366
Silox
13th October 2009, 17:31
Great! I already had been looking for it but I just couldn't find it...
adamshl
13th October 2009, 18:58
Good job!
MariusMM
13th October 2009, 19:01
That's ace! Thanks :)
markorester
14th October 2009, 18:43
nice one :smileypul
bunder9999
14th October 2009, 20:11
keep up the good work vic... :razz:
Zalex
19th October 2009, 01:14
Really nice !
I'll make myself a page with a few frames to see all my servers in one single page. That will be really easy to see what on them in a mouse click... from anywhere !
Thanks. :thumb:
Mostly same informations we get with Airio (Server State) but available on the web... so cool ! hehehe
That will be really handy for team members.
GOOD WORK !!! :D
KlausAdam
20th October 2009, 09:52
Well done!
It would be cool having another div-class for the users. For now I've added DataCont to my css, but I think it would be better to have another div-container for the users.
Original Code:
...
<div id="Version" class="DataCont"><div class="Field1">Version</div><div class="Field2">0.5Z10</div></div>
<div id="Conns" class="DataCont"><div class="Field1">Conns</div><div class="Field2">1 / 47</div></div>
<div id="Users" class="DataCont"><a href="http://www.lfsworld.net/?win=stats&racer=KlausAdam (http://www.lfsforum.net/view-source:http://www.lfsworld.net/?win=stats&racer=KlausAdam)" target="_blank">KlausAdam</a></div>
...Wishful Thinking:
...
<div id="Version" class="DataCont"><div class="Field1">Version</div><div class="Field2">0.5Z10</div></div>
<div id="Conns" class="DataCont"><div class="Field1">Conns</div><div class="Field2">1 / 47</div></div>
<div id="Users" class="DataCont"><div class="Field3">
<a href="http://www.lfsworld.net/?win=stats&racer=KlausAdam (http://www.lfsforum.net/view-source:http://www.lfsworld.net/?win=stats&racer=KlausAdam)" target="_blank">KlausAdam</a></div>
</div>
...
Victor
25th October 2009, 18:51
yes, I think you're correct. So I've added the extra div tags around the list of users. Shouldn't break anyone's layout i think.
SumBeam
21st November 2009, 13:44
When no settings are set in the server, 'Version' is not in the right place...
Click here for an example (http://www.lfsworld.net/hoststatus/?h=[R-R]-Race%20Of%20Champions&hostlink)
Victor
21st November 2009, 13:59
fixed. Thanks for the report.
morpha
21st November 2009, 14:06
While you're on it, could you replace <FONT COLOR=""></FONT> with valid<span class=""></span>
CSS:.cc0 { color: #000 }
.cc1 { color: #F00 }
.cc2 { color: #0F0 }
.cc3 { color: #FF0 }
.cc4 { color: #00F }
.cc5 { color: #F0F }
.cc6 { color: #0FF }
.cc7 { color: #FFF }
.cc8 { color: inherit }
.cc9 { color: inherit }
:tilt:
Victor
21st November 2009, 14:12
maybe one day i can do that, but not right now. My colour conversion function is used by a lot of scripts so i'd have to adjust all their related css as well.
But to meet you half way I've ditched the font tags and replaced them with spans and included style="color: xxxxx;".
morpha
21st November 2009, 14:14
Thanks :razz:
Dygear
22nd November 2009, 17:39
maybe one day i can do that, but not right now. My colour conversion function is used by a lot of scripts so i'd have to adjust all their related css as well.
But to meet you half way I've ditched the font tags and replaced them with spans and included style="color: xxxxx;".
+1 for that :) Thank you.
Azzano62
25th November 2009, 09:43
+1 sounds good would be heaps better :)
Flame CZE
30th November 2009, 17:04
I have one question, why doesn't this link (http://www.lfsworld.net/hoststatus/?h=%5EJ%C9%CFedline%20%5EJ%C9%CFacing%207) work?
It says that the host name is too long, which is not righ, although the server is online.
Shadowww
30th November 2009, 17:14
It does for me.
Firefox 3.5.5.
Flame CZE
30th November 2009, 17:18
I mean, there are some people connected and it says it's offline. Probably some encoding problem.
I'm asking because I want it for one LFS web "app" I'm currently making.
SumBeam
30th November 2009, 18:20
With the url encoding site (first post) I get the name:
%uFF89%uFF8Fedline%20%uFF89%uFF8Facing%207
But, with that name, I get the message:
Hostname cannot be longer than 32 characters.
The code is 42 characters long, that's 10 too much... :x
Flame CZE
30th November 2009, 18:25
SumBeam: Yes, that's what I was referring to in my post.
Dygear
1st December 2009, 07:01
413: Request entity too large.
Wonder how many jokes went around the CERN labs with that one.
SiL-X
1st December 2009, 16:43
Cool feature Victor!
But i have a little question. If i understand right, i just can use THIS html (with this infos)? So i cant "delete" infos.
I can use &hostlink to implement the new lfsjoin link. Is there a possibilty to get a blank hostinfo and with the "&commands" i can add the infos i want?
e.g.:
On www.edrx.de you see just "Track, Slots and Driver".
so i would use following link:
http://www.lfsworld.net/hoststatus/?h=eDRX%20Private&hostlink&track&slots&driver
and get a html like you see on edrx.de!
Is it possible and is it desired?
(Sry, my english isnt the best, i hope i wrote it understandable! :) )
KlausAdam
2nd December 2009, 08:47
If you're able to use PHP then it's quite simple to get the desired behavior.
<?php
$server_info = file_get_contents('http://www.lfsworld.net/hoststatus/?h=' . urlencode('burnoutcrew.net #1 BL') . '&hostlink');
//complete Information from LfS-World
echo $server_info;
//Filter for Sections to delete
$field_delete = array('!<div id="Settings" class="DataCont">(.*?)</div></div>!',
'!<div id="Version" class="DataCont">(.*?)</div></div>!');
$server_info_small = preg_replace($field_delete, "", $server_info);
echo $server_info_small;
?>You only have to modify the $field_delete - array to fit your needs and of cause delete the "echo $server_info" to prevent you from getting the server listed twice :)
SiL-X
8th December 2009, 17:16
Thanks Klaus!
Works fine! :)
IRCheateR
9th December 2009, 14:14
hey Victor, cool feature, but can you made this with white text? for forum header http://niksim.net/community/index.php?act=idx
Flame CZE
9th December 2009, 14:18
You can wrap it with a div or something to change the font color, am I right?
Victor
9th December 2009, 14:18
You can provide a css file to suit your own needs. If you send it to me I'll make it work for you and let you know how to use it.
(flame, he seems to be doing it via an iframe)
Flame CZE
9th December 2009, 14:44
Ah, sorry then :shy:
IRCheateR
18th December 2009, 17:45
did it with php :)
<?php
$ch = curl_init("http://www.lfsworld.net/hoststatus/?h=IR:team%20race%20server");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
Dygear
19th December 2009, 00:52
did it with php :)
function get_host_status($hostName) {
$c = curl_init('http://www.lfsworld.net/hoststatus/?h=' . urlencode($hostName));
curl_setopt($c, CURLOPT_HEADER, 0);
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($c);
curl_close($ch);
return $return;
}
misiek08
20th December 2009, 13:05
Lol. Why with curl? Will it work with file_get_contents? I think it's faster than curl.
Dygear
20th December 2009, 18:00
Lol. Why with curl? Will it work with file_get_contents? I think it's faster than curl.
My LFS World SDK uses both. If file_get_contents is not allowed to go to URLs cURL, if installed, is. (There is no point to having cURL installed if you can't use URL's with it.)
burnlv
9th February 2010, 09:20
did it with php :)
thx man, it was realy usefull! But I got problem with that, It works fine, but the problem is that I putted code into a php fusion panel, and all tha pages background down for server info is changed to white, instead of original black..I thing there something wrong with footer info, how can I change it?
=Wolf=[NO]
3rd March 2010, 14:03
Hostname URL encoding
If you want to use this feature for a host with weird characters in its name, you must "urlencode" the hostname, which means you must convert these weird characters into a format acceptable for use inside an URL. If you're having problems getting this feature to work because it keeps saying the host is offline, you may want to give the following a try.
To make it easy for you I've created a simple page where you can convert any text into urlencoded text : http://www.lfsworld.net/urlencode.html
I might be dumb(rather noob on this), but I am not able to decode "™DB Private" for some reason, the "™" won't "code"....
And another thing, is the colours(used on server name), critical to make it work?
KlausAdam
3rd March 2010, 14:17
This is how it works:
<?php
$server_info = file_get_contents('http://www.lfsworld.net/hoststatus/?h=' . urlencode('™DB Private') . '&hostlink');
//echo complete Information from LfS-World
echo $server_info;
?>The result should look like this:
™DB Private (lfs://join=%99DB%20Private)
Mode S2, Practice
Track Fern Bay Gold Rev
Cars XRG, LX4, LX6, RB4, FXO, XRT, RAC, FZ5, XRR
Settings PSC mp
Version 0.5Z28
Conns 0 / 37
Server colors are not critical as you can see...
Francky30
23rd June 2010, 15:22
Hi guys,
In advance, I'm sorry if my english is bad.
Your methods works fine with our team server but I have a formating problem.(CSS Properties)
In fact, when you call the LFS Hoststatus Page, he call in background his CSS Style too. (Named default.css // Here : http://www.lfsworld.net/hoststatus/styles/default.css)
This CSS have this proprieties :
div {
font: 11px Verdana;
padding: 0px;
margin: 0px;
}
But i use the Wordpress CMS and the div element is used a little bit everywhere in templates.
Native, i use a 13px font size (Body).
But since i've added Hoststatus, every DIVs on my pages have a 11px font size.
Do you know a solution to solve my problem ?
Thanks
EDIT : I don't want a solution like div { font-size: 13px !important; } in the style.css of my template ... Because .. for example, my div footer with a small font size ... and with this "solution", my footer will have a 13px font size too ^^
KlausAdam
23rd June 2010, 15:34
You could call the page by appending &onlycontent to the url. So the css wont' be loaded.
http://www.lfsworld.net/hoststatus/?h=[HSK]%20Demo&onlycontent
result:
<div class="HostName"><span style="color: #000000;">[H</span><span style="color: #FF0000;">S</span><span style="color: #FFFF00;">K</span><span style="color: #000000;">] Demo</span></div>
<div id="Mode" class="DataCont"><div class="Field1">Mode</div><div class="Field2">Demo, Race 5 laps</div></div>
<div id="Track" class="DataCont"><div class="Field1">Track</div><div class="Field2">Blackwood GP</div></div>
<div id="Cars" class="DataCont"><div class="Field1">Cars</div><div class="Field2">FBM</div></div>
<div id="Settings" class="DataCont"><div class="Field1">Settings</div><div class="Field2"> <i><span title="Joining mid-race is allowed">m</span></i></div></div>
<div id="Version" class="DataCont"><div class="Field1">Version</div><div class="Field2">0.5Z9</div></div>
<div id="Conns" class="DataCont"><div class="Field1">Conns</div><div class="Field2">0 / 15</div></div>
<div id="Users" class="DataCont"><div class="Field3"></div></div>
Francky30
23rd June 2010, 15:56
Great ! Thanks KlausAdam !
I just add the CSS of the LFS Hoststatus in my template without the "font: 11px verdana;" propertie and it works great !
Thanks for your rapidity !
avetere
9th December 2010, 22:50
Hey folks!
I've been using this recently using file_get_contents() in my scripts.
Up to yesterday it all went very smooth, but now it is extremely "laggy" and takes about 10-25 seconds to display a result, whereas directly opening the link returns a result instantly (as ist was before within the script) ...
So ... what happened?
bunder9999
10th December 2010, 07:09
does include() work any better?
Dygear
10th December 2010, 07:21
I've been using this recently using file_get_contents() in my scripts.
Up to yesterday it all went very smooth, but now it is extremely "laggy" and takes about 10-25 seconds to display a result, whereas directly opening the link returns a result instantly (as ist was before within the script) ...
So ... what happened?
Going to the link is fine from your home connection? Is the server on your home connection? Can you remote shell into your server and see if you can wget the file in a good amount of time?
does include() work any better?
Would not think so, as php tends to lock down remote inclusion, even when not in safe mode.
morpha
10th December 2010, 08:51
Would not think so, as php tends to lock down remote inclusion, even when not in safe mode.
That's a matter of configuration. With allow_url_fopen and allow_url_include on, remote inclusion is possible. However, this is not recommended and not enabled by default, nor will you find it enabled on any shared hosting service.
As for the issue described, I've tested file_get_contents() on 2 machines, one here at home, one in a datacentre in Germany. The latter is slightly faster, takes 220ms on average to obtain the information from LFSW.
avetere
10th December 2010, 09:01
Going to the link is fine from your home connection?
Yes!
Is the server on your home connection?
No!
Can you remote shell into your server and see if you can wget the file in a good amount of time?
Just testet it ... wget is extraordinarily slow too.
As a matter of fact, I realized later, that other scripts using file_get_contents() (not getting files from lfsworld) are going into timeout too, so it obviously is NOT a lfsw-problem.
Strangely enough, I didn't change anything to my configuration ... I already contacted my hoster for further investigations.
@morpha: Thanks for testing ... I'd have expected similar values before ... by now it takes nearly half a minute to resolve hostname and send http-request (in wget) ... so there's definitely something very wrong ...
bunder9999
10th December 2010, 09:54
@morpha: Thanks for testing ... I'd have expected similar values before ... by now it takes nearly half a minute to resolve hostname and send http-request (in wget) ... so there's definitely something very wrong ...
i can think of two "client-side" reasons for that... crappy DNS server (or local config), or IPV6 being enabled on an IPV4-only network.
Dygear
10th December 2010, 18:59
now it takes nearly half a minute to resolve hostname and send http-request (in wget) ... so there's definitely something very wrong ...
I guess now it's time to track down if it's a DNS issue or something else.
Check this out (http://code.google.com/speed/public-dns/docs/using.html#troubleshooting), but replace Google's DNS IP with your web server's DNS (on the server from the shell) and see if you find any issues from there.
avetere
12th December 2010, 14:52
It actually was an issue with our DNS-server (no idea though what it was that let it go into tilt) ... Our hoster switched us over to another one and now everything is fine again.
Thanks guys and sorry for initially blaming lfsw :D
Fire_optikz001
12th December 2010, 16:22
You could call the page by appending &onlycontent to the url. So the css wont' be loaded.
OMG thats just what i needed to fix the stats on my site :D
SJB
31st January 2011, 02:17
Could add an option to display the names like "drivername (username)" ?
And what about server status graphics in 2 or 3 sizes like tsviewer.com? :nod:
(of course without displaying all the 47 usernames which are connected to the server :razz:)
Regards, SJB
Victor
31st January 2011, 14:01
I don't have playername information, so I can't display that.
As for server graphics, I don't think I'll make those. I'm afraid I don't really see the point.
SJB
1st February 2011, 17:24
Just wrote a little script to get the hoststatus data into variables:
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . './library/');
require_once 'JS/Extractor.php';
// insert the name of your server
$hostname = "Blackwood XFG XRG";
$url = "http://www.lfsworld.net/hoststatus/?h=".urlencode($hostname)."&c=1&onlycontent";
$extractor = new JS_Extractor(file_get_contents($url));
$body = $extractor->query("body")->item(0);
$data = $body->extract(array("div", array("div|span")));
// to see the array / for debug you can uncomment the following 3 lines
// echo "<pre>";
// print_r($data);
// echo "</pre>";
$host = $data[0][0];
$mode = $data[1][1];
$track = $data[2][1];
$cars = $data[3][1];
$settings = $data[4][1];
$version = $data[5][1];
$conns = $data[6][1];
$user = $data[7][0];
?>
It uses the JS_Extractor from http://jacksleight.com/old/code
Regards, SJB
SJB
1st February 2011, 19:34
A little addon for the previous php script:
<?php
// name of the jpg background (any size you want, mine is 400x100)
$background = "lfsstatus.jpg";
$im = imagecreatefromjpeg($background);
// edit to change textcolor e.g. black: 0, 0, 0 white: 255, 255, 255 blue: 0, 0, 255
$textcolor = imagecolorallocate($im, 0, 0, 0);
// imagestring($im, fontsize (1-5), position x, position y, text, color )
imagestring($im, 5, 7, 5, $host, $textcolor);
imagestring($im, 3, 7, 25, "Mode: ".$mode, $textcolor);
imagestring($im, 3, 7, 40, "Track: ".$track, $textcolor);
imagestring($im, 3, 7, 55, "Cars: ".$cars, $textcolor);
imagestring($im, 5, 7, 75, "Connections: ".$conns, $textcolor);
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
.htaccess
RewriteEngine on
RewriteRule status.jpg$ status.php
Demo:
http://cad.rockt.es/lfsstatus/demo.jpg
As attachment the background I used for this ;)
Regards, SJB
Hasan97
20th February 2011, 16:54
How i can put host-http://www.lfsworld.net/hoststatus/?h=Blackwood%20XFG%20XRG with photos?
Tur8o
8th March 2011, 20:44
Hi was just wondering if it was possible for this to be used as html if so could someone help. :thumb:
Do you mean how to include e.g. http://www.lfsworld.net/hoststatus/?h=! (http://www.lfsworld.net/hoststatus/?h=%21)[AMG]+GTR+MotorSport into your page?
<iframe src="http://www.lfsworld.net/hoststatus/?h=![AMG]+GTR+MotorSport" width="320" height="160" align="left" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="server1"> </iframe>And if you want to have the Iframe reloaded every 60seconds:
<iframe src="http://www.lfsworld.net/hoststatus/?h=![AMG]+GTR+MotorSport" width="320" height="160" align="left" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" name="server1" onload="server1.setTimeout(function(){ server1.location.reload();}, 60000);"> </iframe>Regards, SJB
[Audi TT]
30th April 2011, 06:35
Victor,replace here the code in this link http://www.lfsworld.net/hoststatus/?h=AlkoSpirt,%20Practice
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"><head><meta http-equiv="Pragma" content="no-cache" /><meta http-equiv="Expires" content="-1" /><meta http-equiv="Cache-Control" content="no-cache" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link rel="stylesheet" type="text/css" href="http://www.lfsworld.net/hoststatus/styles/default.css" /><title>LFS HostStatus</title></head><body background="ffffff"><div class="HostName"><span style="color: #FF0000;">AlkoSpirt, Practice</span></div>
<div id="Mode" class="DataCont"><div class="Field1">Mode</div><div class="Field2">S2, Practice</div></div>
<div id="Track" class="DataCont"><div class="Field1">Track</div><div class="Field2">Westhill International Rev</div></div>
<div id="Cars" class="DataCont"><div class="Field1">Cars</div><div class="Field2">FXR</div></div>
<div id="Settings" class="DataCont"><div class="Field1">Settings</div><div class="Field2"><strong><span title="Racers are allowed to vote">V</span></strong> <i><span title="Joining mid-race is allowed">m</span></i></div></div>
<div id="Version" class="DataCont"><div class="Field1">Version</div><div class="Field2">0.5Z28</div></div>
<div id="Conns" class="DataCont"><div class="Field1">Conns</div><div class="Field2">0 / 47</div></div>
<div id="Users" class="DataCont"><div class="Field3"></div></div>
</body></html>
luchian
7th May 2011, 22:31
Bit of help, pls: anyone knows hot to alterate the text color inside this iframe with the server status ? (our forum uses a dark grey background and it's veeery difficult to read who's racing, for example). Thank you.
Victor
8th May 2011, 01:02
there's no quick option to change the overal font color.
You can give me a stylesheet replacement if you know how to get the current one and adjust it, or you could tell me the colour you'd like the font to be in and I can make a custom stylesheet for you to use.
luchian
8th May 2011, 13:10
Unfortunately, I don't know how to use CSS. If you can lean a hand that would be great Victor. I think a good color, and inline with our site, would be greenish #9BC21B. This is for the list of who's connected (that today is dark blue and very difficult to spot on dark gray). The rest can remain as it is. Btw, great help the option you have added for changing the color of server name.
For refference, if needed, our forum is here RLR (http://racing-league.forumers.ro/)
Really appreciate your help, thank you.
PS: I managed to find something identified as CSS on the administration panel of our forum; is that maybe what you need ? (attached)
Dygear
8th May 2011, 16:34
http://sixrevisions.com/css/20_websites_learn_master_css/
luchian
9th May 2011, 18:12
http://sixrevisions.com/css/20_websites_learn_master_css/
Hi Dygear, I know that you might've tried to help, but basically you are sugesting that I should start studying CSS for a few hours/days/weeks in order to find what I am looking for (that beeing changing the color of maximum 16 names in the connection list). It's like if I was asking you to help me write "Hello" on a cartonboard, you would suggest me to go to school and after one year I would know to write it myself.
I don't mean to be ignorant, or seem that I don't appreciate the value of everybody's time, but I really never worked with CSS, have no ideea how to use it, and have no ideea what I should look for inside CSS to be able to do the small job that I need.
Thank you for treating this as a constructive comment.
PS: and Google IS my friend
Victor
9th May 2011, 18:23
Unfortunately, I don't know how to use CSS. If you can lean a hand that would be great Victor. I think a good color, and inline with our site, would be greenish #9BC21B. This is for the list of who's connected (that today is dark blue and very difficult to spot on dark gray). The rest can remain as it is. Btw, great help the option you have added for changing the color of server name.
For refference, if needed, our forum is here RLR (http://racing-league.forumers.ro/)
Really appreciate your help, thank you.
PS: I managed to find something identified as CSS on the administration panel of our forum; is that maybe what you need ? (attached)
try this : http://www.lfsworld.net/hoststatus/?h=%21%20RLR%20%2D%20Racing%20League%20Romania&css=2&c=3
luchian
9th May 2011, 18:43
Works like a charm :thumb:. Thank you Victor.
luchian
9th May 2011, 21:13
try this : http://www.lfsworld.net/hoststatus/?h=%21%20RLR%20%2D%20Racing%20League%20Romania&css=2&c=3
Me again :). If I'm not too boldy, would it be possible to have the css file that I suppose you had to create ? This way I could study it, and play with the setting inside, giving the fact that now I have so much study material thanks to Dygear's post. If too much trouble, then just ignore my post; promise I won't mind :)
Dygear
9th May 2011, 21:56
This is your CSS file that Victor made for you; http://www.lfsworld.net/hoststatus/styles/luchian.css from there you can see how most property of CSS work.
If your using Google Chrome, you can do live edits to what you see on the screen. Just go here (http://www.lfsworld.net/hoststatus/?h=%21%20RLR%20-%20Racing%20League%20Romania&css=2&c=3), that's your host, using the CSS file that Vic made, right click anywhere in the document window and go to Inspect Element. From there you should see a 'DOM' at the bottom of your screen. If you can only see the HTML tag, then press the little triage next to it to show it's child elements, from there expand the body also. Now as you move your mouse over the items you see in the DOM list, you should see in the top of your screen where that element is on the HTML page as it highlights it's area when you mouse over it in the DOM list. Clicking on the element in the DOM list, you'll be able to edit it's properties on the right side of the DOM element inspector screen. Scroll down and you should see color with the color of the text on your screen. Just click on the color'ed square (that's the same color as the text within the HTML document) and you'll be able to input any value you want, but keep it to hex. If you don't know what hex is, you've already told me that Google is your friend so you'll have to look that part up for homework.
The problem with teaching someone how to use CSS is that I don't know, at all what you know. I need to know if you know what hex is, because it's a FUNDAMENTAL part of knowing how to manipulate a CSS document, and this is even before you learn how to make a CSS document in the first place. From there, we have to ensure that you know inheritance and specificity works so you don't confuse your self. Asking someone to teach you how to learn CSS is not a simple task, it's hugly time consuming process. But I think one that should be undertaken, but not just for you. Because your asking a question that I bet a lot of people are asking. I could use this as a way to teach you how to make a CSS file for your host info page, but in doing some provide a blueprint for other people to follow so they can do the same themselves for their host. Because of this, I do hope you know nothing about CSS, Hex, HTML or anything so we can teach the widest possible audience from the basic questions that you ask that needed to be answered so that everyone understands it. So please, do ask the stupid questions (and I mean that in the kindest way) because asking is the only way everyone can learn.
And yes, I am a bit of an arse that need to be kicked every now and again, so thanks.
luchian
9th May 2011, 23:29
Honestly, I am impressed. By the exact needed detail of your post (thank you) and also by the attitude (not so oftenly found on the net these days).
Second, I'm gladly accepting your offer 'cause it's not the first time I'm coming face-to-face with CSS, and ussually I don't know how to hide faster.
Coming to facts:
CSS - don't know a single thing about it; no, wait, THE single thing I know is that it has a great power of making your pages look exactly as you imagine, and almost totally independent of the content.
Hex - know what it is and how to find it for any color I would need. Where ? here (http://www.w3schools.com/css/css_colornames.asp), for example. Nothing more.
inheritance and specificity - the terms themselves don't tell me much, but from the context I would suspect that you are talking about the hierarchy between diferent elements in the code. A simple analogy would be the rules of parantheses: {[( )]} ?. On th other hand, if I am wrong, would you care to explain the concept only ?
HTML - have some basic idea about it, from interfering when needed to modify some things here and there.
Q1:
What would be the basic structure/parts of a CSS file ?
Q2:
How do you link a CSS to a web page ?
Remarks:
If some of the things would seem obvious to you, still don't hesitate to post as much detail as possible when writing here (your post above is a great example)
If some times you don't feel that an aspect should be explain here, don't hesitate to suggest the use of Google. The ideea would be to use your time to get the most relevant information on our assigned task >> creating the supreme looking server stats page :P.
And last, thank you for the cool idea.
Dygear
10th May 2011, 00:20
Yeah, I relized that something that is simple to me might be quite complex for someone else. It reminds me of a quote from the 61th episode of Star Trek: The Next Generation, from the Third season, Episode 13 entitled "Déjà Q" where Q says to Geordi LaForge, "Simple. Change the gravitational constant of the universe." expecting Geordi to know how to do that.
Can you recommend a way to counter the effect?
Simple. Change the gravitational constant of the universe.
What?
Change the gravitational constant of the universe, thereby altering the mass of the asteroid.
Redefine gravity. And how am I supposed to do that?
You just do it! Ow! Where's that doctor anyway?
Geordi is trying to say that changing the gravitational constant of the universe is beyond our capabilities.
Oh. Well, in that case, never mind.
----
Q1:
What would be the basic structure/parts of a CSS file ?
Q2:
How do you link a CSS to a web page ?
Anatomy of the CSS file.
The CSS file it's self is just a plain text document, in much the same way that HTML is just a plain text document. The file it's self is not special until you insert data into it. It's most common that a CSS file, CSS by the way stands for Cascading Style Sheet, to end with the extension .css, although that is not required for it to work within your user-agent. The data structure of the CSS file is however special, in a CSS file's most basic form, of selecting one element and altering one property of that element is as follows;
target {
property: value;
}
This is the simplest CSS file that one can produce, but an important first step in understanding CSS as a whole. Where you see target is where the name of the element you would like to change could go. But it's not limited to just HTML elements, you can also target classes by adding a period before the class name, or ID's by pre-pending a hash (#) before the ID's name that you wish to target. These would look like this.
html {
background: #002040;
}
.ClassName {
font-size: 12pt;
}
#ID {
font-size: 12pt;
}
But none of this is any good unless we use it on a HTML document, so how do we do that?
Making CSS Work.
Anyone well formed, by well formed I mean a document that conforms to the standards it's written in, CSS document can be both embedded within a HTML document and linked to it. Now embedding is not what the LFS hosts file does, so we are going to focus on the linked portion of CSS style sheets. Linking a CSS style sheet is as simple as adding a link element to the head of a HTML document, with some special properties. <link rel="stylesheet" type="text/css" href="style.css" /> The first thing you might notice is rel property. Rel is short hand for relationship, meant to tell the user-agent (also known as browser), what this link has to do with the rest of the html file it's reading. The second imporant bit of information it's rel's value, of "stylesheet". This as you might expect, tells the user-agent that this link is the documents style sheet. This can change how the file's prioritization within some user agents that will try to download the style before anything else to that it can display the information to the end user faster. So it's an important first step. The link's type is also spesified as "text/css" telling the user agent that it's a text document that contains css syntax. It should be noted that in HTML5, you can drop this type as long as the rel property is Stylesheet as there is only one language used to markup style within HTML and that is CSS. Last is the href property telling us the "Hypertext REFerence" or simply the location of the linked file. Within a very small HTML5 document that could look like this;
<!DOCTYPE html>
<html>
<head>
<title>HTML5 & CSS Example 1</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1><a href="lfs://host%20name"Host Name</a></h1>
</body>
</html>
I'm going to expand on this later, but I have to get ready for a meeting at my Ambulance Corps.
luchian
10th May 2011, 19:35
: )) that is for the Star Trek part.
Back to work, it doesn't sound so complicated keeping it to the basics. Ok, understood about the structure of file, and how to link it to the HTML document. The next important thing is:
Q3:
How to identify, in the web page, each "target" I wish to alterate, in order to define custom properties for it and only for it ? (I will explain myself: supposing I want to make the first line appear in black color, the second in red and bold, the third in blue, and so on..)
Q4 (bonus):
Supposing I would convince Victor to modify the href in the HTML doc to point to a CSS file on my own server, any modification I would make after that in the CSS would not require Victor's intervention anymore, right ? Or is it not possible ?
Dygear
10th May 2011, 20:12
Q3:
How to identify, in the web page, each "target" I wish to alterate, in order to define custom properties for it and only for it ? (I will explain myself: supposing I want to make the first line appear in black color, the second in red and bold, the third in blue, and so on..)
Q4 (bonus):
Supposing I would convince Victor to modify the href in the HTML doc to point to a CSS file on my own server, any modification I would make after that in the CSS would not require Victor's intervention anymore, right ? Or is it not possible ?
Specific Selection
When you wish to select a specific target, there is no best way. There are more then one way to go about it too. You can in the case of Victor's HTML markup, select each element you want by it's unquie ID (Mode, Track, Car, Settings, Ect ...) That would allow you to color each line a different color like so;
#Mode { color: #000000; }
#Track {color: #FF0000; }
#Car {color: #00FF00; }
#Settings {color: #FFFF00; }
#Version {color: #0000FF; }
#Conns {color: #FF00FF; }
#Users {color: 00FFFF; }
You could change the color of each sub item by;
#Track .Field1 { color: #FFAA00; }
#Track .Field2 { color: #AAFF00; }
#Car .Field1 { color: #00FFAA; }
#Car .Field2 { color: #00AAFF; }
// And so on
You could also make all of the Field1 parts bold in one state like so;
.Field1 { font-weight: bold; }
Good Luck
I don't think that Victor would be willing to do that, as something on the LFS domain to like to a third part domain might cause a secuirty problem on some older browsers.
luchian
10th May 2011, 20:34
Great ! :thumbsup:
Now I have all I need to be able to personalise the look the way I wish. Once it will be finished, I hope Victor won't mind to place it on lfsworld.
Dygear, a big thank you for your patience and time to share your knowledge with me/us.
Regarding Q4, didn't know about the possible glitch, so I'll drop it.
Dygear
10th May 2011, 21:33
Glad you got what you needed. I hope that's enough for everyone else also.
luchian
10th May 2011, 23:11
After a bit of play with the settings, I made a css closer to what I had in mind. I suspect there might be some redundant lines in it, but the end result looks ok.
Would you mind replacing the initial file with the one in attachment, Victor ? Thank you.
LE: you are right again Dygear. Done
Dygear
11th May 2011, 09:00
.Field3 {
}
You can get rid of that one for sure.
luchian
12th May 2011, 22:15
Vic, please ? :)
Victor
13th May 2011, 01:51
ah hadn't noticed sooner - it's updated now.
luchian
13th May 2011, 19:25
Thank you Vic.
Dygear, could you please take a look ? I probably made a mistake, 'cause the background of the server status "square" (on my page) is different from the main background of the page. :(
Q5:
If I remove completely the background parameter in the css, will the page automatically get the background of the main site ? (Remark:I was working locally when I made the testing, so didn't had a possibility to test the comportment).
Dygear
13th May 2011, 22:32
I take it your using an iFrame to load the content onto your website!? Could you provide a link to what page your using your hosts stats on so I can see what you're seeing. Backgrounds within the iFrame take their color from the HTML document they are loaded from. Because of this your going to find the background color of your parent page, and copy it to your hosts css file. If your not sure you have the right color, you can use Google Tools. Right Click on the iFrame from your website, and then go to inspect element. From there you can edit the CSS on the fly until you find the right color, from there copy to your css file and upload here again.
luchian
13th May 2011, 22:41
..for refference, if needed, our forum is here RLR (http://racing-league.forumers.ro/)..
Yes, I use an iframe to show the stats. Q6: Is there another way ?
Yes, I probably sugested the wrong color code (I think the good one is #2f2e2e).. and this means that I have to trouble Victor AGAIN to make the modification..:ashamed:
Q7: In the css, I've set the target #Users {color: #FFA303; } This means that they should be orange-ish, but still they are green-ish. Is it because of the 4th line in body section of css (color: #9BC21B; ) or it has something to do with the fact that the user name it's actually a link ? (a href..)
I'm sorry if I returned to the stupid questions, but the users list cannot be tested locally (by trial and error). The list is apprearing only when showing real status server, thus taking into consideration only the css file on the server.
For easier understanding, attached a photo of what I wish to obtain:
Left side as it is >> Right side as I would wish it
Victor
14th May 2011, 01:13
Q7: In the css, I've set the target #Users {color: #FFA303; } This means that they should be orange-ish, but still they are green-ish. Is it because of the 4th line in body section of css (color: #9BC21B; ) or it has something to do with the fact that the user name it's actually a link ? (a href..)
yep, in the stylesheet there is a declaration for a (anchor) in which the colour #87A817 is defined. So that's what you see there. I've added a "User" class to those user links now though, so one can change the user links independently. I've done that, but there are currently no users on your host, so we'll see later how that turns out.
I've made the background transparent now. This should be the default in case background is omitted, but i've implicitely written it in the body section of the stylesheet anyway.
luchian
14th May 2011, 13:52
Good idea the transparent background >> problem solved.
Reagarding the user name color, still doesn't work; all connected users are shown in light green (only the comma between is orange :) ). Any suggestions ?
My thoughts (I might be totally "off", in that case don't mind them):
The target is a.User or a.Users ?
Q8: Could a target like #Users.field3 {color: #FFA303; } work ?
If no ideas, then could you please just change the orange (#Users {color: #FFA303; } ) to black (#Users {color: #000000; }), so the comma will also be black ? I could live with that also, looks pretty clean.
Thank you for your time Vic, sorry you had to re-look 3, 4 times my demand.
Victor
14th May 2011, 13:56
Think i forgot to the save the hoststatus file last night.
Now the users are orange.
luchian
14th May 2011, 13:57
YES !
Thanks a lot :)
Dygear
14th May 2011, 22:18
Vic, can you detect when a client has admin on a server? Could you add an admin class to their username?
Victor
14th May 2011, 22:56
no i don't have that information.
luchian
14th June 2011, 18:42
Any problem with the page retrieving the host status ?
On our site it shows host offline, but when I run LFS I can connect just fine and the server is running ok. Thank you in advance.
Victor
14th June 2011, 18:47
no, everything's supposed to be working as normal. E.g. http://www.lfsworld.net/hoststatus/?h=Blackwood%20XFG%20XRG
Maybe the hostname changed (slightly) and so there's a discrepancy between the actual hostname and what you use for the hoststatus.
Or tell me the name of the host and i'll have a look.
luchian
14th June 2011, 18:56
! RLR - Racing League Romania
(wow, that was fast)
Victor
14th June 2011, 18:59
i don't see it in my hostlist data (is the host hidden now?). Can you join the host, so i can perhaps find out more?
oh, maybe it's a Z3x test host? In that case, please upgrade it to 0.6A3. The old test versions have been disabled in the master server now, so they'll no longer show up on lfsworld.
luchian
14th June 2011, 19:02
No, that's exactly this: the host is not hidden, it is open to everybody; and it runs like that for a few monthe now. Only from yesterday I see it reported as offline, and it's not listed in LFS host list anymore, as you say.
For testing purpose, you can try joining with Join Specific Host, by name, if that could help ?
luchian
14th June 2011, 19:07
Yes, it was Z30. Ok, I'll ask for an update. I apreciate your quick answer, thank you.
Victor
14th June 2011, 19:07
I see now that your host really is hidden. At least, that's what the data tells me here. Please double check.
oh - well in any case, it was stored like a hidden host. See how it goes after the upgrade then I guess.
luchian
14th June 2011, 19:14
That's odd; we've never set it as hidden; in any case we'll update host version and we'll see how it goes from there. Thanks a lot.
Lucian
LE: Problem solved after host update at 0.6A3. Cheers.
Billicp
13th July 2011, 15:17
Ok i have a quick question ?
I have my server status on our website. www.rf1.moonfruit.com but there status has not updated its self ? any reason why ???? its still showing people who was in the server a hour ago lol
Billicp
13th July 2011, 15:29
i need the server status in a html snippet form
Victor
13th July 2011, 15:41
In your iframe you should just link to the hoststatus feature directly : http://www.lfsworld.net/hoststatus/?h=!%20REAL%20F1%20!
That gives real time status, whereas atm it seems like you cache it and call it via this url http://www.rf1.moonfruit.com/cgi-bin/snippet.cgi?todo=as_page&instance=4553279816&num=12
Tomrius
27th November 2011, 23:20
hi is iht phoshepil to get a LFS master list on a home page i em the owner off http://lfs-server-stats.forumn.net/
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.