Login   Register  
PHP Classes
elePHPant
Icontem

File: daoc_guild_test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Brian Murphy  >  DaocGuildXML  >  daoc_guild_test.php  >  Download  
File: daoc_guild_test.php
Role: Example script
Content type: text/plain
Description: An example demo using the class to display the guild information in a table.
Class: DaocGuildXML
Dark Age of Camelot Guild XML parser
Author: By
Last change:
Date: 12 years ago
Size: 4,911 bytes
 

Contents

Class file image Download
<?php

    
// Example file for daoc guild xml class

    // -----------------------------------------------------------
    // Include the Class File
    
include_once('daoc_guild_xml.class.php');

    
// Set the file name and create the guild object
    
if(!$file) {
      
$file 'http://www.camelotherald.com/guilds/Igraine/517.xml';
    }
    
$guild = new DaocGuildXML();
    
$guild->setFileName($file);

    
// Parse the file
    
$guild->parseFile();
    
$char_attr $guild->getCharAttributes();
    
// -----------------------------------------------------------

?>
<body bgcolor=white>
<style type=text/css>
.key {
  font-family: Verdana;
  font-weight: bold;
  font-size: 9pt;
}
.smvalue {
  font-family: Verdana;
  font-size: 8pt;
}

.value {
  font-family: Verdana;
  font-size: 9pt;
}
</style>

<table border=0 cellpadding=0 cellspacing=1>
<form method=POST>
  <tr>
    <td bgcolor=#3f3f3f>
      <table border=0 cellpadding=3 cellspacing=1>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            Guild XML File:
          </td>
          <td colspan=2 bgcolor=#ffffff>
            <input type=text name=file size=60 class=smvalue value="<?=$file?>">
            <input type=submit class=value value="Go">
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Guild Name:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <?=$guild->tree["GUILD"]["NAME"]?>
          </td>
          <td bgcolor=#ffffff class=key rowspan=2 valign=center align=center>
          Guild Emblem
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Guild Realm:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <?=$guild->tree["GUILD"]["REALM"]?>
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Active Characters:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <?=$guild->tree["GUILD"]["ACTIVECHARS"]?>
          </td>
          <td bgcolor=#ffffff valign=center align=center rowspan=6>
            <table border=0 cellspacing=0 cellpadding=0>
              <tr>
                <td width=80 height=100 valign=top
                    background="<?=$guild->tree["GUILD"]["SSHIELD"]?>">
                <div align=center><img src="<?=$guild->tree["GUILD"]["SEMBLEM"]?>
                    width=64 height=64></div>
            </td></tr></table>
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Active Members:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <?=$guild->tree["GUILD"]["ACTIVEMEMBERS"]?>
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Total Guild Realm Points:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <?=$guild->tree["GUILD"]["GUILDRP"]?>
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Guild Contact:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <a href="mailto:<?=$guild->tree["GUILD"]["CONTACTURL"]?>">
            <?=$guild->tree["GUILD"]["CONTACTURL"]?></a>
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Guild Website:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <a href="http://<?=$guild->tree["GUILD"]["WEBSITEURL"]?>">
            http://<?=$guild->tree["GUILD"]["WEBSITEURL"]?></a>
          </td>
        </tr>
        <tr>
          <td bgcolor=#ffffff class=key align=right>
            <b>Last Update:</b>
          </td>
          <td bgcolor=#ffffff class=value>
            <?=$guild->tree["GUILD"]["TIMESTAMP"]?>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</form>
</table>

<p>
<table border=0 cellpadding=0 cellspacing=0>
  <tr>
    <td bgcolor=#3f3f3f>
      <table border=0 cellpadding=2 cellspacing=1>
        <tr>
<?
  
print "<td nowrap class=key bgcolor=#ffffff>NAME</td>";
  foreach (
$char_attr as $attr) {
    print 
"<td nowrap class=key bgcolor=#ffffff>
            
$attr
          </td>"
;
  }
  print 
"</tr>";
  foreach (
$guild->tree["MEMBERS"] as $name => $prop) {
    print 
"<tr><td nowrap bgcolor=#ffffff class=smvalue>$name</td>";
    foreach (
$char_attr as $attr) {
      
$value $guild->tree["MEMBERS"]["$name"]["$attr"];
      if (!
$value) { $value "&nbsp;"; }
      print 
"<td nowrap bgcolor=#ffffff class=smvalue>$value</td>";
    }
  }

?>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>