[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

[php] det her må kunne gøres pænere



Følgende kodestump må kunne omskrives til noget mere elegant. Formålet er
vist åbenlyst (at konvertere [url]-tags til links), men problemet er, at for
at overholde xhtml-standarden skal & skrives i html-notationen, &

$input = str_replace("&", "&amp;", preg_replace("{\[url\](.*?)\[/url\]}", "<a href='\\1'>\\1</a>",$input));
$input = str_replace("&", "&amp;", preg_replace("{\[url=(.*?)\](.*?)\[/url\]}", "<a href='\\1' title='\\1'>\\2</a>",$input));
/* Ugly as hell, but this should make &amp; in the textual representation go away */
$input = preg_replace("{(<a.*>.*)&amp;(.*</a>)}", "\\1&\\2", $input);
-- 
//anders


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-07-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *