Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][XML], Jak wywołać dane z pliku
crea
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 28.04.2009

Ostrzeżenie: (0%)
-----


Mam taki plik:

  1. <?xml version="1.0"?>
  2. <player name="Beginner" account="1" voc="1" level="1797" access="5" banned="0">
  3. <spawn x="127" y="160" z="7"/>
  4. <temple x="307" y="245" z="7"/>
  5. <skull type="0" kills="0" ticks="0" absolve="0"/>
  6. <health now="7742" max="7742" food="1000"/>
  7. <mana now="37938" max="38010" spent="1471680"/>
  8. <ban banned="0" banstart="0" banend="0" comment="" reason="" action="" deleted="0" finalwarning="0" banrealtime=""/>
  9.  
  10. <skills>
  11. <skill skillid="0" level="20" tries="513"/>
  12. <skill skillid="1" level="15" tries="10"/>
  13. <skill skillid="2" level="15" tries="10"/>
  14. <skill skillid="3" level="17" tries="1850"/>
  15. <skill skillid="4" level="15" tries="10"/>
  16. <skill skillid="5" level="15" tries="10"/>
  17. <skill skillid="6" level="15" tries="10"/>
  18. </skills>
  19.  
  20. <inventory>
  21. <slot slotid="2">
  22. <item id="2173"/>
  23. </slot>
  24.  
  25. <slot slotid="7">
  26. <item id="2507"/>
  27. </slot>
  28.  
  29. <slot slotid="8">
  30. <item id="2643"/>
  31. </slot>
  32. </inventory>
  33.  
  34. </player>


Jeśli chcę sprawdzic czy wartosc 'health max' jest rowna 2000 to wpisuję:

  1. <?php
  2. if(isset($player-> data ->health['max']==2000)){...
  3. ?>


Co muszę wpisać by wywołać ' slot slotid="2" i w tym item id="2173" ' ?

Probowalem juz wpisac
  1. <?php
  2. if(isset($player-> data ->inventory->(slot['slotid']==2)->(item['id']==2173))){...
  3. ?>

ale to jednak nie pomogło

Proszę o pomoc, jak mam to wywołac?

Ten post edytował crea 6.06.2009, 19:10:21
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 21:22