Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Poruszanie się po elementach w DOMDocument
Agape
post 9.06.2011, 12:35:26
Post #1





Grupa: Zarejestrowani
Postów: 384
Pomógł: 13
Dołączył: 16.06.2006

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


Witam. Dokumentacja jest w miarę mizerna i nie bardzo rozumiem jak mogę poruszać się po elementach DOM. Mam takie coś

  1. <td>
  2. <div>tekst</div>
  3. </td>
  4. <td>
  5. <div>
  6. <textarea name="text"></textarea>
  7. </div>
  8. </td>


I muszę pobrać wartość div w którym jest "tekst". Pomożecie?

Obecnie mam tylko takie coś ;/

  1. $html = new DOMDocument();
  2. $html->loadHTML($c);
  3. $tagi = $html->getElementsByTagName('textarea');
  4.  
  5. foreach ($tagi as $tag) {
  6. if($tag->getAttribute('name')=='text'){
  7. //szukaj tekstu
  8. }
  9. }


Ten post edytował Agape 9.06.2011, 13:09:53


--------------------
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 14:14