Topic: PHP and XML (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: under your rug, |
posted 05-20-2007 08:58
I don't really use XML that much but I have been screwing with PHP for a long time, PHP 5 is suppose to have some cool XML fuctions which I am trying to grasp but really falling short in the understanding. |
Paranoid (IV) Inmate From: Norway |
posted 05-20-2007 11:33 |
Maniac (V) Inmate From: there...no..there..... |
posted 05-28-2007 20:40
see if this might help : code: $request_url = "http://www.worldofwarcraft.com/realmstatus/status.xml"; $xml_data = simplexml_load_file($request_url) or die("feed not loading"); echo "<pre>"; var_dump($xml_data); echo "</pre>";
code: $request_url = "http://www.worldofwarcraft.com/realmstatus/status.xml"; $xml_data = new SimpleXMLElement($request_url,null,true); foreach($xml_data_ as $rs) { echo "Name: {$rs['n']}" . "<br />"; echo "Type : {$rs['t']}" ."<br />"; echo "Status : {$rs['s']}" ."<br />"; echo "Load" : {$rs['l']}" . "<br />"; }
code: <xsl:call-template name="rankingRowAlternate"/> − <xsl:choose> − <xsl:when test="@t = 1"> <small style="color: #234303;">Normal</small> </xsl:when> − <xsl:when test="@t = 2"> <small style="color: #660D02;">(PVP)</small> </xsl:when> − <xsl:when test="@t = 3"> <small style="color: #535600;">(RP)</small> </xsl:when> − <xsl:when test="@t = 0"> <small style="color: #535600;">(RPPVP)</small> </xsl:when> </xsl:choose>
|
Maniac (V) Inmate From: there...no..there..... |
posted 05-30-2007 03:49
i was actually playing around with this a few minutes ago. code: <? $request_url = "http://www.worldofwarcraft.com/realmstatus/status.xml"; // load as file $xml_data = new SimpleXMLElement($request_url,null,true); ?> <table width="100" cellpadding="5" cellspacing="5" border="1"> <tr> <td>Name</td> <td>Type</td> </tr> <? foreach($xml_data as $rs) { echo "<tr>"; echo "<td>" . "{$rs['n']}" . "</td>"; $typeServer = $rs['t']; if($typeServer == "1"){ echo "<td>" . "Normal" ."</td>"; }elseif ($typeServer == "2"){ echo "<td>" . "(PVD)" . "</td>"; }else{ echo "<td>" . "RP" . "</td>"; } echo "</tr>"; } ?> </table>
|
Paranoid (IV) Inmate From: under your rug, |
posted 06-19-2007 18:46
i guess my post to this never actually went through lol, damn school connection lag >.< |