I am working on a webpage far an online game I play. The other webmaster does not know PHP, and I am relatively new... So here is the problem:
A page he wrote in HTML outputs fine. We wantr to convert it to PHP for simplifying the update of the page. The page is a list of people in my organization in the game. Here is the HTML code he wrote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>Total Aggression Gaming</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a { text-decoration:none }
table#memberslist thead tr td{
cursor : hand;
font-family: arial;
font-size : 12px;
color : #FFCC00;
font-weight : bold;
}
.regular {
color: #FFFFCC;
font-family: arial, helvectia, times;
font-size: 12px;
}
a:link {
COLOR: #777777;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
a:visited {
COLOR: #777777;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
a:active {
COLOR: #777777;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
a:hover {
COLOR: #888888;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
body {
scrollbar-face-color: #151515;
scrollbar-shadow-color: #353535;
scrollbar-highlight-color: #B2B2B2;
scrollbar-3dlight-color: #353535;
scrollbar-darkshadow-color: #353535;
scrollbar-track-color: #777777;
scrollbar-arrow-color: #6E7E88;
}
-->
</style>
</head>
<body bgcolor="#000000" leftmargin="0" topmargin="20" text="#CCCCCC">
<table class="regular" id="memberslist" align="center" width="90%" cellspacing="0" border="0">
<thead>
<tr>
<td align="left" class="boxTitle">Name</td>
<td align="left" class="boxTitle">Rank</td>
<td align="left" class="boxTitle" width="70">Level</td>
<td align="left" class="boxTitle">Profession</td>
<td align="left" class="boxTitle">Gender</td>
<td align="left" class="boxTitle">Breed</td>
</tr>
</thead>
<tr>
<td>Argulace</td>
<td>0 President</td>
<td>200</td>
<td>Fixer</td>
<td>Male</td>
<td class="breed">Opifex</td>
</tr>
<tr>
<td>Saurun</td>
<td>1 General</td>
<td>200</td>
<td>Adventurer</td>
<td>Male</td>
<td class="breed">Solitus</td>
</tr>
<tr>
<td>Combateer</td>
<td>1 General</td>
<td>200</td>
<td>Enforcer</td>
<td>Neuter</td>
<td class="breed">Atrox</td>
</tr>
...........................................
broken to shorten the post
...........................................
</table>
</body>
</html>
Here is my PHP conversion:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Total Aggression Gaming</title>
<style type="text/css">
<!--
a { text-decoration:none }
table#memberslist thead tr td{
cursor : hand;
font-family: arial;
font-size : 12px;
color : #FFCC00;
font-weight : bold;
}
.regular {
color: #FFFFCC;
font-family: arial, helvectia, times;
font-size: 12px;
}
a:link {
COLOR: #777777;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
a:visited {
COLOR: #777777;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
a:active {
COLOR: #777777;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
a:hover {
COLOR: #888888;
FONT-WEIGHT: ;
TEXT-DECORATION: none
}
body {
scrollbar-face-color: #151515;
scrollbar-shadow-color: #353535;
scrollbar-highlight-color: #B2B2B2;
scrollbar-3dlight-color: #353535;
scrollbar-darkshadow-color: #353535;
scrollbar-track-color: #777777;
scrollbar-arrow-color: #6E7E88;
}
-->
</style>
</head>
<body bgcolor="#000000" leftmargin="0" topmargin="20" text="#CCCCCC">
<table class="regular" id="memberslist" align="center" width="90%" cellspacing="0" border="0">
<thead>
<tr>
<td align="left" class="boxTitle">Name</td>
<td align="left" class="boxTitle">Rank</td>
<td align="left" class="boxTitle" width="70">Level</td>
<td align="left" class="boxTitle">Profession</td>
<td align="left" class="boxTitle">Gender</td>
<td align="left" class="boxTitle">Breed</td>
</tr>
</thead>
<?php
/********************************************************************************************
****************************Do Not Alter Below this Line ************************************
********************************************************************************************/
// Guild Roster Generator
// version 2003.02.28
//$guildnumber[]=1245185; // MoK
//$guildnumber[]=3993601; // Mini-MoK
// make this 1 if you want extra info while the script is running
// make it 0 if you want silent running
$debug=0;
set_time_limit(20);
function splicedata($sourcefile, $start, $end)
{
error_reporting(0);
$temp=split($start, $sourcefile);
$temp=split($end, $temp[1]);
error_reporting(1);
return $temp[0];
}
function splicemultidata($sourcefile, $start, $end)
{
error_reporting(0);
$targetdata = array();
$sourcedata = split($start, $sourcefile);
foreach ($sourcedata as $indsplit)
{
$target = split($end, $indsplit);
$targetdata[] = $target[0];
}
error_reporting(1);
return $targetdata;
}
$members=array();
$i=0;
$guildurl = "http://www.anarchy-online.com/org/stats/d/1/name/1245185/basicstats.xml";
if ($debug) echo "<br>downloading \"$guildurl\" ...";
$guilddata="";
$connection2 = @fopen("$guildurl", "r");
if ($connection2)
{
while (!feof ($connection2))
{
$guilddata .= fgets ($connection2, 4096);
}
fclose($connection2);
}
if ($debug) echo "<br>download complete!.<br>";
$lastupdated = splicedata($guilddata, "<last_updated>", "</last_updated>");
$guildname = splicedata($guilddata, "<name>", "</name>");
$guilddata = splicedata($guilddata, "<members>", "</members>");
if ($debug) echo "Processing all the members for $guildname<br>";
foreach (splicemultidata($guilddata, "<member>", "</member>") as $member)
{
if (splicedata($member,"<nickname>" ,"</nickname>" )!="")
{
$members[$i]['nick name' ]=splicedata($member,"<nickname>" ,"</nickname>" );
$members[$i]['rank' ]=splicedata($member,"<rank>" ,"</rank>" );
$members[$i]['rank name' ]=splicedata($member,"<rank_name>" ,"</rank_name>" );
$members[$i]['level' ]=splicedata($member,"<level>" ,"</level>" );
$members[$i]['profession']=str_replace(" ","_",splicedata($member,"<profession>" ,"</profession>"));
$members[$i]['gender' ]=splicedata($member,"<gender>" ,"</gender>" );
$members[$i]['breed' ]=splicedata($member,"<breed>" ,"</breed>" );
if ($members[$i]['breed' ]=="Nano")
$members[$i]['breed' ]="Nanomage";
$i++;
}
}
if (debug==1) echo "<br><br>Creating roster.....<br><br>";
$i =0;
foreach ($members as $member)
{echo "
<tr>
<td>".$members[$i]['nick name' ]."</td>
<td>".$members[$i]['rank' ]." ".$members[$i]['rank name' ]."</td>
<td>".$members[$i]['level' ]."</td>
<td>".$members[$i]['profession']."</td>
<td>".$members[$i]['gender' ]."</td>
<td>".$members[$i]['breed' ]."</td>
</tr>";
$i++;
}
?>
</table>
</body>
</html>
Both function great..but the PHP version lost the formatting of the scroll bar. We need the formating to keep teh continuity with the rest of the official wesite. Anyone with a solution? Any help is greatly appreciated.
View the temporary HTML version here
and the PHP version here.