- Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>C.I.P.H.E.R. #073</title>
<style type="text/css" media="all">
@import "http://www.nationstates.net/ns_v61.css";
</style><!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLt #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLt #sidebar1 { padding-top: 30px; }
.twoColFixLt #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>
<body class="twoColFixLt">
<div id="container">
<div id="mainContent">
<h1> Regional Overview </h1>
<h2>(C.I.P.H.E.R Document#073)</h2>
<table><th>Nation<th>Influence<th>WA<th>Endorsements<th>Region
<?php
function get_data($nation, $shards = FALSE) {
if($shards != FALSE) {
$file = 'http://www.nationstates.net/cgi-bin/api.cgi?nation=' . $nation . '&q=' . $shards;
}
else {
$file = 'http://www.nationstates.net/cgi-bin/api.cgi?nation=' . $nation;
}
$xml = simplexml_load_file($file);
return $xml;
}
ini_set('user_agent', 'YOUR NATION HERE');/* You will need to enter your "main" nation name here, so that site admins can identify where the request is originating and contact you if there are any problems with the script */
function display_strategic_report($nation) {
$data = get_data($nation, 'name+influence+wa+endorsements+region');
$name = (string) $data->NAME;
$influence = (string) $data->INFLUENCE;
$wa = (string) $data->UNSTATUS;
$endorsements = (string) $data->ENDORSEMENTS;
$region = (string) $data->REGION;
echo "<tr><td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$name'>$name</a>";
echo "<td>$influence</a>";
echo "<td>$wa</a>";
echo "<td>$endorsements</a>";
echo "<td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/region=$region'>$region</a>";
}
/* enter the names of the nations you wish to interrogate below - maximum 50 */
display_strategic_report('hallensbane');
display_strategic_report('Nephmir');
display_strategic_report('schmunt');
display_strategic_report('vulcanlandia');
display_strategic_report('dauq');
display_strategic_report('the_church_of_flying_spaghetti_monster');
display_strategic_report('alexanderlandia');
display_strategic_report('paulstralia');
display_strategic_report('yeilding2u2');
display_strategic_report('nebal');
display_strategic_report('the_great_neon');
display_strategic_report('coasthedge');
display_strategic_report('the_united_federalist_republic');
?></table>
<!-- end #container --></div>
</body>
</html>
If the region you are examining contains less than 50 nations you could use the above to monitor developments
- The "endorsement" field could probably be tweaked to give you a "count" of the endorsers rather than their names
- User input could possibly added so that manually completing each "display_strategic_report" is not necessary (perhaps even importing from a dossier file?)
- A shard for "Soft Power Disbursement Rating" would be a valuable enhancement
PS you can't see on the screenshot but there is a column to the far right that shows the Region each nation is in.
Alternatively perhaps the existing Dossiers we have could be re-coded to give endorsements held and SPDR values?