who can tell me how to convert detrox's page to <a href = 'http://detrox'>detrox's page</a>
thanks very much.
About Convert a UBB-Like Code to HTML
Moderator: General Moderators
Umm.. I'm guessing you wrote this without the spaces and it got parsed:
[ url ] http://detrox'>detrox's page [ /url ]
Try a str_replace to search for [ url ] and [ /url ] and then replace former with '<a href="' and latter with $var. '">' . $var . '</a>'
str_replace is case sensitive - preg_match if that's an issue
[ url ] http://detrox'>detrox's page [ /url ]
Try a str_replace to search for [ url ] and [ /url ] and then replace former with '<a href="' and latter with $var. '">' . $var . '</a>'
str_replace is case sensitive - preg_match if that's an issue
preg_replace
This is what I use:
It can be modified to parse other things as well. Read up on the preg_replace function to understand what it's doing.
Avoid using str_replace especially on tags that - if left open can break your html layout.
Code: Select all
$str=preg_replace("/\їurl\](ї^\ї]*?)\ї\/url\]/i","<a target='_blank' href='\\1'>\\1</a>",$str);Avoid using str_replace especially on tags that - if left open can break your html layout.