Jump to content

Writing a forum - Parsing links


alfone

Recommended Posts

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.
Link to comment
https://forums.phpfreaks.com/topic/28171-writing-a-forum-parsing-links/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.