PDA

View Full Version : Question for Menno...


01-03-2001, 05:08 PM
You wrote for me some mods to a hack for displaying the most recent threads on a separate page. Remember, you wrote the part that stripped out URL strings and IMG strings. I have a question about it.

I've noticed that sometimes, a URL string (or IMG) still shows up. Now I've noticed that they all have the http:// part, and as far as I can tell from the way you wrote the mods, it only looks for the URL string if it starts with a www.

So could you do me a favor and add the necessary parts to this so that it will do the same thing for URL strings that start with http:// that it does for those that start with www? Thanks!

// split apart long URL strings
$newstext=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=_blank>\\1</a>",$newstext);
$newstext=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" class=\"sidebar1\" target=_blank>(hyperlink)</a>",$newstext);

$newstext=eregi_replace("\\[url=\"([^\"]*)\"\\]([^\\[]*)\\[\\/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$newstext);
$newstext=eregi_replace("\\[url=([^\"]*)\\]([^\\[]*)\\[\\/url\\]","<a href=\"\\1\" class=\"sidebar1\" target=_blank>(hyperlink)</a>",$newstext);

// kill image tags
$newstext=eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]","(image)",$newstext);

//special thank-you to Menno at vBulletin Community Forum for coming up with the above two hacks!

01-04-2001, 07:49 AM
When I posted that code a while back I foud that I'd forgotten some stuff. I actually fixed it, but forgot to mention it :D

http://vbulletin.com/forum/showthread.php?threadid=5668

just grab that code again, it should work.