leods92 0 Denunciar post Postado Abril 17, 2006 aew pessoal, gostaria q voces vissem ai o meu script para ver o que acontece de errado. A tabela não carrega... a pagina em """"funcionamento"""": http://oteods.servegame.com:8090/houses.php eu uso o xampp com php 5.0 O script é: <?php$root = "C:\xampp\htdocs\oteooods\data\\";// first some table setupprint (" <table border=\"0\" width=\"92%\"> <tr bgcolor=cccccc> <td align=center><span class=style17><B>Nome:</B></td><td align=center><span class=style17><B>Tamanho:</B></td><td align=center><span class=style17><B>Estado:</b></td></span> </tr> "); // Fetch the houses.xml file that we get all the house data from $file = $root . "houses.xml"; // Create a new simplexml object to work with $houseXML = simplexml_load_string(file_get_contents($file)); // Loop through each house tag and fetch data about that house foreach($houseXML->house as $house) { // Assign the house name attribute to a simple variable $house_name = $house['name']; // Make sure we start counting the house tiles at 0 $tile_count = 0; // Loop through each tile tag to count how many tiles the house has foreach($house->tiles as $tiles) { // geting from cords $from_x = $tiles['fromx']; $from_y = $tiles['fromy']; $from_z = $tiles['fromz']; // geting to cords $to_x = $tiles['tox']; $to_y = $tiles['toy']; $to_z = $tiles['toz']; // Check stuff if($to_z < $from_z) { $old_to_z = $to_z; $to_z = $from_z; $from_z = $old_to_z; } $count_x = $to_x - $from_x + 1; $count_y = $to_y - $from_y + 1; $count_z = $to_z - $from_z + 1; $tiles_to_add = ($count_z * $count_x * $count_y); $tile_count += $tiles_to_add; $houseXML = simplexml_load_string(file_get_contents($root . "houses/" . $house_name . ".xml")); if($houseXML->owner['name'] == NULL) { $owner_status = '<span class=style50>Livre</span>'; } else { $owner_status = "<span class=style11>Comprada por</span>"; } foreach($house->tile as $tile) { $tile_count++; } foreach($houseXML->owner as $owner) { // Assign the house name attribute to a simple variable $house_owner = $owner['name']; } } print (" <tr bgcolor=F7F7F7> <td align=center><span class=style51>" . $house_name . "</span></td><td align=center><span class=style51>" . $tile_count ."</span></td><td align=center><span class=style17><b>". $owner_status ." <a href='$linkchar2$house_owner'>$us" . $house_owner ."</a></td> </tr> "); }?></table> Compartilhar este post Link para o post Compartilhar em outros sites
wolfphw 60 Denunciar post Postado Abril 17, 2006 Cara pelo oke eu vi, o seu problema esta logo no começo do seu script...ali onde você especifica o caminho do arquivo..Muda akilo para algo assim...Digamos que dentro da raiz da página dentro dele você tenha a pasta DATA onde esta o arquivo .xml que você quer usar..$root = "data/";Tenta fazer isso.. que eu acho que jah resolve o seu problema..Pois no seu você esta especificando um caminho da sua maquina que nao existe no servidor Compartilhar este post Link para o post Compartilhar em outros sites
leods92 0 Denunciar post Postado Abril 17, 2006 a minha máquina é o servidor ;) Compartilhar este post Link para o post Compartilhar em outros sites
wolfphw 60 Denunciar post Postado Abril 17, 2006 entaum ai nesse seu caso eu naum sei como ajudar.... que nunca mexi com arquivos .xml :( Compartilhar este post Link para o post Compartilhar em outros sites