Writing a forum - Parsing links
Posted: Wed Nov 22, 2006 5:32 pm
NOTE: Square brackets [,] have been replaced with curly brackets {,} so that the forum does not parse my post.
I'm writing a barbones forum in PHP, and am having trouble figuring out how to parse the links from the user generated {url=http://www.domain.com}domain.com{/url} to the proper HTML of < a href="http://www.domain.com/" >domain.com< /a >.
The other stuff, {b}{i}{u} is easy, 'cause you can just run str_replace to switch out the user entered tags, to the html... but with the link, the domain is a wildcard and i need to grab it from between the "{url=" and the "}".
Does anybody know how to chnage {url=http://www.domain.com}domain.com{/url} to < a href="http://www.domain.com" >domain.com< /a > with a simple string function?
Thanks in advance for the help.
I'm writing a barbones forum in PHP, and am having trouble figuring out how to parse the links from the user generated {url=http://www.domain.com}domain.com{/url} to the proper HTML of < a href="http://www.domain.com/" >domain.com< /a >.
The other stuff, {b}{i}{u} is easy, 'cause you can just run str_replace to switch out the user entered tags, to the html... but with the link, the domain is a wildcard and i need to grab it from between the "{url=" and the "}".
Does anybody know how to chnage {url=http://www.domain.com}domain.com{/url} to < a href="http://www.domain.com" >domain.com< /a > with a simple string function?
Thanks in advance for the help.