PDA

View Full Version : vb code


Craig Antill
Thu 20th Apr '00, 4:39am
Please can you change the vb code for a url, to remove the quote marks - this will confuse the stupid people (such as myself!) who are used to 'that other forum' :)

John
Fri 21st Apr '00, 1:50am
Unfortunately, that is not very easy to do. I spent a good few hours trying to get it to work like that with PHP's regular expression engine, but I had to give up in the end. :(

If anyone else thinks that they can succeed where I have failed, here is the code:


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


John

Stallion
Fri 21st Apr '00, 2:38am
I was just trying to get this to work in a propriatary commenting system just yesterday. I ended up using blah (whatever=url)
Its not the best format, but it works. I'll probably go the "" route, seeing as its a lot easier to adjust to.

WebStyles
Tue 2nd May '00, 1:00pm
Am I totally missing something here? I changed it to

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

It's running live on [url="http://www.were-here.com/forums/index.php"]were-here.com forums (([^\"), and it works just fine. Is that the wrong way to do it?

John
Wed 3rd May '00, 1:37am
It works like that? I'll give it a spin on my machine later - I thought that I had tried everything, but obviously not :(

Thanks for the suggestion.

John

werehere
Wed 3rd May '00, 1:45am
It seems to be working fine on our forum.:)

WebStyles
Wed 3rd May '00, 1:57am
John, it was actually pretty funny... I was trying to get my [swf] BB Code to work, and I figured I needed the quotes in there, but then they would always just show up escaped when I tested the code. Finally I got so frustrated, I took the quotes out all together and it worked, so I figured I would try it on the URL's too, I can't believe it worked! :D

John
Wed 3rd May '00, 5:47am
Oh great! Looks like support for both with and without quotes for the next version then! :)

John

WebStyles
Wed 3rd May '00, 5:52am
I'm not as bad at PHP as I originally thought! ;)