Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> regexp pobieranie tagow html
deirathe
post
Post #1





Grupa: Zarejestrowani
Postów: 426
Pomógł: 32
Dołączył: 24.05.2007

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


Mam takiego stinga (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
$tpl=
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Untitled Document</title>
  5. </head>
  6.  
  7. <ui:include file="sa.tpl" />
  8. <ui:cache time="3h">
  9. <ui:loop select="as">
  10. sds
  11. </ui:loop>
  12. </ui:cache>
  13.  
  14.  
  15. <ui:loop select="asd" max="4" step="2" >
  16. <ui:var select="mVar" />
  17. tekst<ui:loop select="aaaa"><ui:loop select="aaaa"><ui:loop select="aaaa">
  18. <ul>teskt<li>1</li></ul>
  19. <ui:loop select="aaaa">
  20. <ui:include file="sa.tpl" />
  21. </ui:loop></ui:loop>sdsfdsfs</ui:loop>
  22. </ui:loop>
  23. <ui:if test="mVar GT asd">
  24. tak
  25. </ui:if>
  26. <ui:include file="sa.tpl" />
  27.  
  28.  
  29. <ui:include file="sa.tpl" />
  30. <ui:loop select="as">
  31. sds<ui:include file="sa.tpl" />
  32. </ui:loop>
  33. </body>
  34. </html>


I kiedy wywołuje
  1. <?php
  2. $tag="loop";
  3. preg_match_all("#<ui:".$tag."([^<]*?)(/>|>(.*?)</ui:".$tag.">)#is",$tpl,$res);
  4. ?>

to dostaje
  1. <ui:loop select="asd" max="4" step="2" >
  2. <ui:var select="mVar" />
  3. tekst
  4. <ul>teskt<li>1</li></ul>
  5. <ui:loop select="aaaa">
  6.  
  7. </ui:loop>

zamiast
  1. <ui:loop select="asd" max="4" step="2" >
  2. <ui:var select="mVar" />
  3. tekst
  4. <ul>teskt<li>1</li></ul>
  5. <ui:loop select="aaaa">
  6.  
  7. </ui:loop>
  8. </ui:loop>

wie ktos jak zrobic zeby regexp pobieral tagi tak jak nalezy?

dobra rozwiazane
  1. <?php
  2. preg_match_all("#<ui:".$tag."([^<]*?)(/>|>(.*?)</ui:".$tag.">)#Uis",$tpl,$res);
  3. ?>


i chyba raczej nie dziala :/ jak ktos moze to prosilbym o pomoc

Ten post edytował deirathe 11.02.2008, 23:30:37
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: 21.12.2025 - 18:02