vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin Forum Sideblocks - Rift Shard Status Block (https://vborg.vbsupport.ru/showthread.php?t=259547)

Jedric 02-26-2011 10:00 PM

Rift Shard Status Block
 
1 Attachment(s)
Want to add a shard status block for Rift to your forums or CMS?
  1. Go to Forums & Moderators, Forum Blocks Manager. Click "Add Block".
  2. For the title, name it something like "______ Shard Status".
  3. Cache Time = 1
  4. Active = Yes
  5. Content Type = PHP
  6. Content:
    PHP Code:

     // The URL of the official shard status feed
     
    define ('URL''http://www.riftgame.com/en/status/na-status.xml');
     
     
    // Change this to the name of your shard
     
    define ('SHARD''Deepstrike');
     if((
    $fp fopen(URL'r'))) {
            
    $respMsg '';
            while(!
    feof($fp)) {
                
    $buffer .= fgets($fp128); 
      }
            
    fclose($fp);
            
    $output '';
      
    $doc DOMDocument::loadXML($buffer);
      if (
    $doc) {
       
    $domXPath = new DOMXPath($doc);
       
    $filtered $domXPath->query('/status/shard[@name="' SHARD '"]');
       if (
    $filtered->length == 1) {
        
    $shardStatus $filtered->item(0);
        
    $shardIsUp = (strcasecmp($shardStatus->getAttribute('online'), 'True') == 0);
        
    $shardPopulation $shardStatus->getAttribute('population');
        if (
    strcasecmp($shardPopulation'high') == 0) {
         
    $shardPopulation '<span style="color: red;">High</span>';
        } else if (
    strcasecmp($shardPopulation'medium') == 0) {
         
    $shardPopulation '<span style="color: orange;">Medium</span>';
        } else if (
    strcasecmp($shardPopulation'low') == 0) {
         
    $shardPopulation '<span style="color: green;">Low</span>';
        }
        
    $shardIsLocked = (strcasecmp($shardStatus->getAttribute('locked'), 'True') == 0);
        
    $shardQueue $shardStatus->getAttribute('queued');
        
    $output .= '<center><p><b>Status:</b><br>';
        if (
    $shardIsLocked) {
         
    $output .= '<span style="color: red;">Locked</span>';
        } else if (
    $shardIsUp) {
         
    $shardIsUp $output .= '<span style="color: green;">Online</span>' $output .= '<span style="color: red;">Offline</span>';
         
    $output .= '</p><p><b>Population:</b><br>';
         
    $output .= $shardPopulation '<br></p><p><b>Queue:</b><br>' $shardQueue '</p>';
        }
        
    $output .= '<br />Code by <a href="http://nervehq.com" target="_blank">Nerve</a>.';
        
    $output .= '</center>';
        return 
    $output;
       }
      }
        } else {
         return 
    '';
        } 

  7. Change define ('SHARD', 'Deepstrike'); to define ('SHARD', 'YourShardName');
  8. Click "Save".
  9. You are done.

Example:
http://nervehq.com/forums/

reersh9 03-01-2011 03:06 PM

How would I add this in as a widget to the frontpage?

Jedric 03-02-2011 01:00 AM

Same code, except in a CMS PHP Widget.

lucige 03-08-2011 01:39 PM

any idea if this usable in vbadvanced? If so I'm newer to this so I must be missing something.

reersh9 03-13-2011 02:17 PM

Quote:

Originally Posted by Jedric (Post 2168512)
Same code, except in a CMS PHP Widget.

I'm sorry Jedric. I'm very unfamiliar with all of this but I really would like to add this to the frontpage. So I add a PHP Direct Execution widget I'm guessing? Just put the code in that?

Edit: I tried creating both a PHP Direct Execution widget entitled Rift Shard Status with a similar description. I put that configured the widget entering the code in the field and calling it vbcms_widget_shard_status. I added a style with the same name (vbcms_widget_shard_status) and put the code in there too. Needless to say, it didn't work.

I'd appreciate some help for a vB noob.

See: www.metaredux.com

overdriven12 03-30-2011 11:18 PM

It got some Errors:

Warnung: fopen() [function.fopen]: URL file-access is disabled in the server configuration in [path]/includes/block/html.php(95) : eval()'d code (Zeile 6)

Warnung: fopen(http://www.riftgame.com/en/status/eu-status.xml) [function.fopen]: failed to open stream: no suitable wrapper could be found in [path]/includes/block/html.php(95) : eval()'d code (Zeile 6)

Warnung: fopen() [function.fopen]: URL file-access is disabled in the server configuration in [path]/includes/block/html.php(95) : eval()'d code (Zeile 6)

Warnung: fopen(http://www.riftgame.com/en/status/eu-status.xml) [function.fopen]: failed to open stream: no suitable wrapper could be found in [path]/includes/block/html.php(95) : eval()'d code (Zeile 6)

Jedric 03-30-2011 11:47 PM

Quote:

URL file-access is disabled in the server configuration
It looks like you need to enable something in your server config. The problem is not with the code.

overdriven12 03-31-2011 12:37 AM

Quote:

Originally Posted by Jedric (Post 2179246)
It looks like you need to enable something in your server config. The problem is not with the code.

thx bro problem solved :D

dune3000 05-26-2011 11:09 PM

Not working for me . shows only date any help?


All times are GMT. The time now is 02:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01067 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete