Sign Up! Login: Password: New User? Forgot? Support
Code 
 
 
Forums 
Forums : Server Status > Custom WoW Server Status (using XSL)
Mottie (SuperAdmin) 12/19/2008 3:39 AM EST : Custom WoW Server Status (using XSL)
ACK!
Mottie
Posts: 3883

0
Like

0
Dislike

How To Add A Custom WoW Server Status Box (using XSL)

GuildPortal admin site link to original post

NOTE: There is now a WoW Server Status Widget. If you want a more personalized server status widget, you can still use the code from this post.

Requirements

  • First off, this will only work on paid subscription sites
  • If you have a free site and want to add a server status box, read this thread.
  • You will need to make the file below and host it on your GP site.
  • Note: if your subscription runs out, this code will stop working and you will get a message saying it won't work on free sites.

The CSS

.statusBox {
 background: url(http://i201.photobucket.com/albums/aa236/Mottie1/testsite/styles/status-alliance.png) top center no-repeat;
 color: #ffffff;
 height: 150px;
 padding-top:60px;
}
html>body .statusBox { height: 90px;}
.statusBox img { position: relative; top:5px; }
.serverUpColor { color: #ffffff; font-size: 16px; }
.serverdownColor { color: #bbbbbb; font-size: 16px; }

.pve { color: #00ff00; }
.pvp { color: #ff0000; }
.rp { color: #fff000; }
.rppvp { color: #ff8000; }

.lowload { color: #00ff00; font-size: 14px; vertical-align:center; }
.mediumload { color: #ff8000; font-size: 14px; vertical-align:center; }
.highload { color: #ff0000; font-size: 14px; vertical-align:center; }
.maxload { color: #ff00ff; font-size: 14px; vertical-align:center; }

The XML

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" indent="yes"/>
<xsl:template match="/">
<div class="statusBox" align="center">
<xsl:for-each select="page/rs/r">

<xsl:if test="@n='Durotan'">

 <xsl:choose>
  <xsl:when test="@s=1">
   <b class="serverUpColor"><xsl:value-of select="@n"/></b>
  </xsl:when>
  <xsl:otherwise>
   <b class="serverDownColor"><xsl:value-of select="@n"/></b>
  </xsl:otherwise>
 </xsl:choose>
 <xsl:choose>
  <xsl:when test="@t=1"><span class="pve"> (PvE)</span></xsl:when>
  <xsl:when test="@t=2"><span class="pvp"> (PvP)</span></xsl:when>
  <xsl:when test="@t=3"><span class="rp"> (RP)</span></xsl:when>
  <xsl:when test="@t=4"><span class="rppvp"> {RPPvP)</span></xsl:when>
 </xsl:choose>
<br />
 <xsl:choose>
  <xsl:when test="@s=1">
   <img src="http://www.worldofwarcraft.com/shared/wow-com/images/icons/serverstatus/uparrow.gif" width="18" height="18"/>
  </xsl:when>
  <xsl:otherwise>
   <img src="http://www.worldofwarcraft.com/shared/wow-com/images/icons/serverstatus/downarrow.gif" width="18" height="18"/>
  </xsl:otherwise>
 </xsl:choose>
 <xsl:choose>
  <xsl:when test="@l=1"><span class="lowload"> Low</span></xsl:when>
  <xsl:when test="@l=2"><span class="mediumload"> Medium</span></xsl:when>
  <xsl:when test="@l=3"><span class="highload"> High</span></xsl:when>
  <xsl:when test="@l=4"><span class="maxload"> Max</span></xsl:when>
 </xsl:choose>
</xsl:if>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>

Installing & Customizing

  • CSS

    • Start by adding the CSS to your Custom StyleSheet or add it to a free form text/HTML box on the same page (but add a <style> to the top and </style> to the bottom)
    • Modify the CSS colors (in blue) to your liking.
    • Change the Status box size (in red) to fit your background image (in orange). The height in the ".statusBox" sets the height in IE. The height in "html>body .statusBox" sets the height in all other browsers.
    • The above CSS has the alliance background image, get the horde background image here.
    • If you don't want the server type or server load to display in the status, simply change the class in the CSS like this:

      .pvp { display:none; }

  • XML

    • Open your text editor (like Notepad) then copy (Ctrl-C) the XML above and paste (Ctrl-V) it into your editor.
    • Change your server name (in green). It is case sensitive!
    • If you want to change the up and/or down arrows in the server status, replace the URL (in orange). If you want to use text instead of an image, replace that entire line with something like this:

      <span style="color:#ffffff;">Up</span>

    • Save the file someplace on your computer where you can find it easily, name it something like "serverstatus.xsl".

  • Installing

    • Upload your xsl file to your site:

      Control Panel > File Manager > Upload File(s) > Browse > find your file

      Click "Upload File(s)"

      Copy this URL!

    • Add a new content box to the page you desire:

      Control Panel > Site Pages > (Home) > Add New

      Title: Server Status (or whatever you want)
      Type: XML/XSL Transformation
      Zone: (Pick one)

      Click "Add"

    • Now find your new content box and click "Edit"

    • A popup window will appear with "XML/XSL Transformation Editor" at the top.... add the following:

      XML Url: http://www.worldofwarcraft.com/realmstatus/status.xml
      XSL Url: Paste the link to your XSL file here.
      XSL Content: Leave blank... I haven't figured out how to get this to work yet, it would be better since you wouldn't have to save a file to your site.
      XSL Source: Select "Use XSL URL"

      Click "Save"
Enjoy! typer happy

Edit (2/23/2010): Added "server" in front of the serverUpColor and serverDownColor CSS classes... sorry I missed that. Of course I updated the admin forum post on 4/9/2009 =/.
Edit (2/23/2010): Removed references about hosting the xsl on some other site, it's now easier to upload it to your GP Files.
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

 
 
Key 
New posts No new posts
New posts ( popular ) No new posts ( popular )
New posts ( sticky ) No new posts ( sticky )
New posts ( locked ) No new posts ( locked )
 
 
Who's Online 
There are   members online.
 
 
So-and-so has logged on!
%title%
%message%