mikelmao Posted December 30, 2008 Share Posted December 30, 2008 Hey. I Recently found out how i could make BBCode's.. I would like to know, How can i make a Url BB Code? As in: THIS: to <a href='http://google.com'></a> How do i get those values? please help. Thank you Quote Link to comment Share on other sites More sharing options...
mikelmao Posted December 30, 2008 Author Share Posted December 30, 2008 No-one knows? Quote Link to comment Share on other sites More sharing options...
dMilesFox Posted December 30, 2008 Share Posted December 30, 2008 THIS: its empty! Quote Link to comment Share on other sites More sharing options...
opalelement Posted December 30, 2008 Share Posted December 30, 2008 THIS: its empty! because this board parsed it preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/", "<a href=\"\\1\" target=\"_blank\">\\2</a>", $text_body); Quote Link to comment Share on other sites More sharing options...
flyhoney Posted December 30, 2008 Share Posted December 30, 2008 Uhm... The BBcode for url is: [ url=http://www.example.com]Check out this awesome website![ /url] Are you asking how to write BBcode or parse BBcode? Quote Link to comment Share on other sites More sharing options...
mikelmao Posted December 30, 2008 Author Share Posted December 30, 2008 Whats the diff? (Sorry im very new to PHP.. and im trying to learn) Quote Link to comment Share on other sites More sharing options...
mikelmao Posted December 30, 2008 Author Share Posted December 30, 2008 Hello? Quote Link to comment Share on other sites More sharing options...
Absorbator Posted December 30, 2008 Share Posted December 30, 2008 Hi there, If you want this www.google.com to became <a href>www.google.com</a> then use this code $outputString=preg_replace('/\[url\](.*?)\[\/url\]/is', "<a href='$1' title='$1'>$1</a>", $inputString); BUT if you want something more advanced then use this $ouputString=preg_replace('/\[url\=(.*?)\](.*?)\[\/url\]/is', "<a href=$1>$2</a>", $inputString); I hope this helps Quote Link to comment Share on other sites More sharing options...
mikelmao Posted December 30, 2008 Author Share Posted December 30, 2008 i dont understand it please explain Quote Link to comment Share on other sites More sharing options...
flyhoney Posted December 30, 2008 Share Posted December 30, 2008 Can you explain what you need to do a little better? Like, the context of the problem you are solving. Quote Link to comment Share on other sites More sharing options...
Absorbator Posted December 30, 2008 Share Posted December 30, 2008 i dont understand it please explain Look dude, I think you've messed with the "Regular Expressions" and you just cannot understand them. If this is the case, then Google them. As you see, you use "preg_replace" function, instead of "str_replace" and this is the trick. ---------------- Now playing: Metallica - Nothing Else Matters via FoxyTunes Quote Link to comment Share on other sites More sharing options...
mikelmao Posted December 30, 2008 Author Share Posted December 30, 2008 i just want a BB_Code. when i type in a Text Field [url=google.com]Click here[/url] it looks like Click here Quote Link to comment Share on other sites More sharing options...
opalelement Posted January 1, 2009 Share Posted January 1, 2009 i just want a BB_Code. when i type in a Text Field [url=google.com]Click here[/url] it looks like Click here if you were to make it only to google.com then it would be trying to find a directory within the cwd named "google.com", otherwise you need more checking to look for the http:// you need to understand regex to do it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.