NamelessMC

Internet Explorer

Internet Explorer is not supported. Please upgrade to a more modern browser.

Customzing Play Page
Started by GoogleGamer98

GoogleGamer98

GoogleGamer98

Member
Joined
26 May 2016
Last Seen
13 Dec 2016
Topics
3
Posts
7

Hi 

I want to customize the Play Page and change it so that doesn't say Play and instead says servers with a drop down menu that contains each server and the status of that server, online offline. How would I go about doing this. Do I create a custom addon and can you help me find all the code that is needed to do this and if it works I might upload it :P

GoogleGamer98 · over 8 years ago
GoogleGamer98

GoogleGamer98

Member
Joined
26 May 2016
Last Seen
13 Dec 2016
Topics
3
Posts
7

Actually how do you add a dropdown menu to the navigation

GoogleGamer98 · over 8 years ago
Samerton

Samerton

Owner
Joined
30 Mar 2015
Last Seen
22 Dec 2024
Topics
41
Posts
1076

Unfortunately this wouldn't be too easy to implement in the current release, however I've made a quick example of how this could be done at the moment.

Add this code to around line 57 of core/includes/template/navbar.php

Create a new file in the pages folder named "servers.php", and paste this code inside.

You can then customise the servers.php page as you wish.

Samerton · over 8 years ago
GoogleGamer98

GoogleGamer98

Member
Joined
26 May 2016
Last Seen
13 Dec 2016
Topics
3
Posts
7

Okay thank you that worked, but how would I add a server status to the side and display a URL based on each server and can I add a server status in the dropdown like for each server displayed in the drop down :3 (it will be probs be a dot)

GoogleGamer98 · over 8 years ago
Samerton

Samerton

Owner
Joined
30 Mar 2015
Last Seen
22 Dec 2024
Topics
41
Posts
1076

You'd be able to do all this within core/includes/template/navbar.php, if you change the code I provided for the navbar.php file to query each server within the foreach loop, you can then display the server status in the dropdown items, and also assign server information into a Smarty variable which can be displayed in the template files (styles/templates).

Unfortunately I can't provide any sample code for this, it's something which can be quite advanced because if the query is run on every page load, it could slow your page down by a number of seconds, so you'd need to cache each query for a minute or two (there is a caching library included, you can see it in use in the core/init.php file).

Hope that helps, sorry I can't really be of more use here as the current 1.x system is pretty rigid in terms of customisations; this is something which will be changed for the future 2.x releases.

Samerton · over 8 years ago
GoogleGamer98

GoogleGamer98

Member
Joined
26 May 2016
Last Seen
13 Dec 2016
Topics
3
Posts
7

okay thank you, I love namelessmc and I have been working on customizing it a lot. I will work on this and see what I can do. Thank you for your help and I can't wait to see what will happen in future releases. One thing I want to ask on the play page is says connect to the server with the IP: (ip). how do I add that to each server page that is done through the query :3. it is simply just a line? 

GoogleGamer98 · over 8 years ago
Samerton

Samerton

Owner
Joined
30 Mar 2015
Last Seen
22 Dec 2024
Topics
41
Posts
1076

I've updated the gist code for pages/servers.php to display the text, I haven't tested it but hopefully there won't be any issues.

Samerton · over 8 years ago
Partydragen

Partydragen

Management
Joined
15 Jan 2016
Last Seen
17 Dec 2024
Topics
15
Posts
112

i working with a server page too http://cubedcraft.com/servers

Its not finish will add server status and player counter if i get it to work

My minecraft name: Partydragen
My Website: https://partydragen.com/
Owner of CubedCraft network: https://cubedcraft.com/

Partydragen · over 8 years ago