Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Usuwanie div o określonym class
black_jack
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 29.04.2012

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


Cześć (IMG:style_emoticons/default/smile.gif)

Mam kod strony :

  1. ...
  2. </head>
  3. ...
  4. <div class="1"></div>
  5. <div class="2"></div>
  6. ...


Chciałbym usunąć całego takiego diva (z poziomu skryptu php) o określonym class. Nie mam pomysłu jak to zrobić.

Czyli np. chce usunąć całego div o class="2".

Jakieś sugestie? (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
!*!
post
Post #2





Grupa: Zarejestrowani
Postów: 4 298
Pomógł: 447
Dołączył: 16.11.2006

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


preg_replace
Cytat
/\<div class=\"1\"\>\<\/div\>/


Ten post edytował !*! 1.08.2012, 18:41:41
Go to the top of the page
+Quote Post
black_jack
post
Post #3





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 29.04.2012

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


Czyli jak to ma być?

  1. preg_replace('','','/\<div class=\"1\"\>\<\/div\>/');


Nie wiem jak tego użyć (IMG:style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post
emkej
post
Post #4





Grupa: Zarejestrowani
Postów: 48
Pomógł: 5
Dołączył: 18.06.2012

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


Wszystko masz w manualu:
  1. preg_replace('/\<div class=\"1\"\>\<\/div\>/','',$kod_strony);

gdzie $kod_strony to Twoj kod HTML.
Go to the top of the page
+Quote Post
Niktoś
post
Post #5





Grupa: Zarejestrowani
Postów: 1 195
Pomógł: 109
Dołączył: 3.11.2011

Ostrzeżenie: (10%)
X----


A zobacz tutaj:
http://php.net/manual/en/book.dom.php
Go to the top of the page
+Quote Post

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: 23.08.2025 - 07:00