strong-storm Posted August 11, 2004 Report Share Posted August 11, 2004 Nu vajadzeetu, lai no $comments pazustu visi <i><u><b> </i></u></b> Link to comment Share on other sites More sharing options...
bubu Posted August 11, 2004 Report Share Posted August 11, 2004 $newtext = str_replace(array('<i>','<u>','<b>','</i>','</u>','</b>'), array('','','','','',''), $oldtext); Link to comment Share on other sites More sharing options...
strong-storm Posted August 11, 2004 Author Report Share Posted August 11, 2004 (edited) nav kaut kaada iebuuveeta f-ja, kas apkautu visus html kodus? Edited August 11, 2004 by strong-storm Link to comment Share on other sites More sharing options...
bubu Posted August 11, 2004 Report Share Posted August 11, 2004 (edited) Nu atver manuāli un paskaties tak!!! http://lv.php.net/strip_tags Edited August 11, 2004 by bubu Link to comment Share on other sites More sharing options...
Venom Posted August 12, 2004 Report Share Posted August 12, 2004 $newtext = str_replace(array('<i>','<u>','<b>','</i>','</u>','</b>'), array('','','','','',''), $oldtext); $newtext = str_replace(array('<i>','<u>','<b>','</i>','</u>','</b>'),'', $oldtext); $text=preg_replace('<.*>','',$text); Link to comment Share on other sites More sharing options...
bubu Posted August 12, 2004 Report Share Posted August 12, 2004 Venom, protams ar preg_replace to var panākt universālāk, bet es jau sākumā domāju, ka cilvēkam vajag tikai šos sešus tagus apkaut :) Link to comment Share on other sites More sharing options...
Venom Posted August 12, 2004 Report Share Posted August 12, 2004 Venom, protams ar preg_replace to var panākt universālāk, bet es jau sākumā domāju, ka cilvēkam vajag tikai šos sešus tagus apkaut :) bubu, neattaisnojies ;) tevi es palaboju tikai tajā str_replace variantā, ar to otru parametru, jo If search is an array and replace is a string; then this replacement string is used for every value of search. Vispār es uzrakstīju un turpinu pilnveidot f-ju, kas atstātu tikai atļautos tagus un to atļautos atribūtus, jo strip_tags var atstāt e.g. <b style="height:1000%" onclick="..."></b>. Link to comment Share on other sites More sharing options...
strong-storm Posted August 12, 2004 Author Report Share Posted August 12, 2004 Nu paldies! Link to comment Share on other sites More sharing options...
raivis Posted January 7, 2005 Report Share Posted January 7, 2005 Man nestrādā $text=preg_replace('<.*>','',$text); bet strādā gan šādi: $text = 'Vai <b>te</b> kāds ir<i>!</i>'; echo preg_replace("'(<.*?>)'",'',$text) Link to comment Share on other sites More sharing options...
orion Posted January 7, 2005 Report Share Posted January 7, 2005 hmz, es izmantoju strip_tags(); lai apkarotu visus tagus... Link to comment Share on other sites More sharing options...
blackhalt Posted January 7, 2005 Report Share Posted January 7, 2005 (edited) Īstenībā jau filtri tā saucamie kaut kādi jātaisa ;) ~ : http://paste.php.lv/1507 utml.... Edited January 7, 2005 by blackhalt Link to comment Share on other sites More sharing options...
vik Posted January 14, 2005 Report Share Posted January 14, 2005 pavisam vienkārši: <?PHP $text = "<b>blablabla</b>blabla<u>blabla</u>"; $from = array("<",">"); $to = array("<",">"); $text = str_replace($from,$to,$text); echo $text; ?> Link to comment Share on other sites More sharing options...
Venom Posted January 14, 2005 Report Share Posted January 14, 2005 2vik, tādā gadījumā labāk izmantot htmlspecialchars(), jo < un > zīmes es varu savadīt arī kā oktālās/unicode stringas. Link to comment Share on other sites More sharing options...
Recommended Posts