Xenforo Server Status Help

Status
This thread has been locked.
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Misaki

Supreme
Feedback score
68
Posts
740
Reactions
1,859
Resources
0
Yep, that's pretty simple. Just use MCAPI. It gives you a JSON response back with the data. All you have to do is output it.
Thank you for your quick reply, I was wondering if you could show some screenshots or something, as I am fairly new to this.
 

Misaki

Supreme
Feedback score
68
Posts
740
Reactions
1,859
Resources
0
<script>
var playerCount = document.getElementById("playersOnline")
var playerCountRequest = new XMLHttpRequest();
playerCountRequest.open("GET", "https://mcapi.ca/v2/query/players/?ip=skyblock-mc.net", true);
playerCountRequest.onreadystatechange = function() {
if (playerCountRequest.readyState === 4 && playerCountRequest.status === 200) {
var playerCountReply = JSON.parse(playerCountRequest.responseText)
playerCount.innerHTML = playerCountReply.players.online
}
}
playerCountRequest.send(null)
</script>

and call it in with a span:

<h1>There are <span id="playersOnline"></span> online!</h1>
Thanks so much!
 

xExecutorx

Retired Builder
Supreme
Feedback score
3
Posts
499
Reactions
244
Resources
0
<script>
var playerCount = document.getElementById("playersOnline")
var playerCountRequest = new XMLHttpRequest();
playerCountRequest.open("GET", "https://mcapi.ca/v2/query/players/?ip=skyblock-mc.net", true);
playerCountRequest.onreadystatechange = function() {
if (playerCountRequest.readyState === 4 && playerCountRequest.status === 200) {
var playerCountReply = JSON.parse(playerCountRequest.responseText)
playerCount.innerHTML = playerCountReply.players.online
}
}
playerCountRequest.send(null)
</script>

and call it in with a span:

<h1>There are <span id="playersOnline"></span> online!</h1>
Hi there,

I've got the same question as Misaki. Where would we paste this code at (location)?

Thanks.

Regards,
xExecutorx
 

xExecutorx

Retired Builder
Supreme
Feedback score
3
Posts
499
Reactions
244
Resources
0
<head>



<script>
Put in here
</script
</head>
Hi there,

My apologies, though where in our Xenforo Admin Panel?

Example: Admin > Appearance > Templates > Extra.css

Sorry for all of the questions. Though when it comes to something like this, we're very inexperienced.

Thanks.

Regards,
xExecutorx
 

Wvisoecj

Supreme
Feedback score
9
Posts
471
Reactions
677
Resources
0
You have to have it wherever you coded the header at.
Actually you should put it before the body closing tag. That way all the DOM content has loaded and you wont be accessing unbuilt DOM content on slow connections.
 

xExecutorx

Retired Builder
Supreme
Feedback score
3
Posts
499
Reactions
244
Resources
0
You have to have it wherever you coded the header at.
I may have someone do this for us, as I am still VERY confused. As said above, we're very inexperienced with this kind of thing, so yes. Thanks for all of your help.

Also, by "header" do you mean Admin Home > Styles > Website_theme > Header and Navigation > ?
 

Wvisoecj

Supreme
Feedback score
9
Posts
471
Reactions
677
Resources
0
I may have someone do this for us, as I am still VERY confused. As said above, we're very inexperienced with this kind of thing, so yes. Thanks for all of your help.

Also, by "header" do you mean Admin Home > Styles > Website_theme > Header and Navigation > ?
Add to the footer if you can. That way it will work for users with slow connections.
 

xExecutorx

Retired Builder
Supreme
Feedback score
3
Posts
499
Reactions
244
Resources
0
No that's CSS. I'm not sure how XenForo works but you need to add it before the </body> tag
Alright, great. I believe that we've decided to post a thread and try to find someone to do this for us. Since we're focusing on different things, getting this off of our backs would be a lot better.

Thanks for your help Croc, Wvisoecj, and Faded Dev.

Best wishes,
xExecutorx
 

Obelisk

Developer
Premium
Feedback score
0
Posts
12
Reactions
10
Resources
0
Alright, great. I believe that we've decided to post a thread and try to find someone to do this for us. Since we're focusing on different things, getting this off of our backs would be a lot better.

Thanks for your help Croc, Wvisoecj, and Faded Dev.

Best wishes,
xExecutorx
I'd be happy to it for you.
 
Status
This thread has been locked.
Top