par
sylvaing26 » 19 oct. 2009, 10:49
Un petit exemple à modifier pour ton code trouvé sur la toile
Il ne faut s'interresser qu'a la synthaxe pour l'URL
$string = 'This is [b]cool[/b] - [url=http://www.tutorio.com]Tutorio.com Tutorials[/url]
$bb-replace = array ('/(\[[Bb]\])(.+)(\[\/[Bb]\])/','/(\[url=)(.+)(\])(.+)(\[\/url\])/');
$bb-replacements = array ('<b>\\2</b>','<a href="\\2">\\4</a>');
$string = preg_replace($bb-replace, $bb-replacements, $string);
print $string;
Un petit exemple à modifier pour ton code trouvé sur la toile
Il ne faut s'interresser qu'a la synthaxe pour l'URL
[php]
$string = 'This is [b]cool[/b] - [url=http://www.tutorio.com]Tutorio.com Tutorials[/url]
$bb-replace = array ('/(\[[Bb]\])(.+)(\[\/[Bb]\])/','/(\[url=)(.+)(\])(.+)(\[\/url\])/');
$bb-replacements = array ('<b>\\2</b>','<a href="\\2">\\4</a>');
$string = preg_replace($bb-replace, $bb-replacements, $string);
print $string;
[/php]