Page 1 of 1
php coding question

Posted:
Wed Jan 12, 2011 2:58 pm
by Dr Evil
Hey Guys
I currently use PunBB as the forum board for my clans website, and I am trying to add some additional BBcode for formatting text and posting youtube video's. However, I am unsuccessful.
I found an addon script for PunBB that allows me to add additional code, but I have to edit the "parser.php" file, I know a little about php, but I guess im not doing something right because I cant get it to work.
I have posted on the support forums for punbb a couple days ago, but no one has responded, and I tried emailing the guy that wrote the plugin, but email comes back undeliverable.
I was wondering if someone here would be willing to look at the code and tell me what im doing wrong?
Kind Thanks,
.:-{DrEvil}-:.
Re: php coding question

Posted:
Wed Jan 12, 2011 10:05 pm
by Dr Evil
*gentle bump*
Re: php coding question

Posted:
Thu Jan 13, 2011 9:37 am
by zombie@computer
I can give advise about coding in terms of syntax, but i dont know anything about punbb.
Re: php coding question

Posted:
Thu Jan 13, 2011 1:54 pm
by ROFLhacks
is this what you where looking for, i got it from here
http://www.vbulletin.com/forum/showthread.php/199304-How-To-Make-a-YouTube-BB-Code- Code: Select all
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/{param}"></param><embed src="http://www.youtube.com/v/{param}" type="application/x-shockwave-flash" width="425" height="350"></embed></object>
Re: php coding question

Posted:
Thu Jan 13, 2011 4:07 pm
by Dr Evil
Sorta, I tried that one too... the one I've been trying to get to work is this one....
http://www.punres.org/desc.php?pid=416I have to add this to my parser.php:
- Code: Select all
$pattern = array('#\[b\](.*?)\[/b\]#s',
'#\[i\](.*?)\[/i\]#s',
'#\[u\](.*?)\[/u\]#s',
'#\[url\]([^\[]*?)\[/url\]#e',
'#\[url=([^\[]*?)\](.*?)\[/url\]#e',
'#\[email\]([^\[]*?)\[/email\]#',
'#\[email=([^\[]*?)\](.*?)\[/email\]#',
'#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#s',
'#\[youtube\](.*?)\[/youtube\]#s',
);
$replace = array('<strong>$1</strong>',
'<em>$1</em>',
'<span class="bbu">$1</span>',
'handle_url_tag(\'$1\')',
'handle_url_tag(\'$1\', \'$2\')',
'<a href="mailto:$1">$1</a>',
'<a href="mailto:$1">$2</a>',
'<span style="color: $1">$2</span>',
'<span class="bbs">$1</span>',
'<p class="bbcenter">$1</p>',
'<p class="bbleft">$1</p>',
'<p class="bbright">$1</p>',
'<p class="bbjustify">$1</p>',
'<p class="bbindent">$1</p>',
'<div class="bbvideo"><object width="425" height="350" align="top" data="http://www.youtube.com/v/$1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.youtube.com/v/$1" /><param name="quality" value="best" /><embed src="http://www.youtube.com/v/$1" width="425" height="350" quality="best" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed></object></div>',
);
But I guess im not doing something right when I add it, cus im getting T_STRING errors

Re: php coding question

Posted:
Thu Jan 13, 2011 4:18 pm
by zombie@computer
'<div class="bbvideo"><object width="425" height="350" align="top" data="http://www.youtube.com/v/$1" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="http://www.youtube.com/v/$1" /><param name="quality" value="best" /><embed src="http://www.youtube.com/v/$1" width="425" height="350" quality="best" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed></object></div>',
put that all on one line. ''-enclosed data does not recognise enters
Re: php coding question

Posted:
Thu Jan 13, 2011 4:37 pm
by Dr Evil
Well, that sorta worked... but now I get just a big while box
http://www.thestkclan.net/forums/viewto ... pid=73#p73
Re: php coding question

Posted:
Thu Jan 13, 2011 9:09 pm
by zombie@computer
check your source. the thing inbetween [youtube] [/youtube] seems to expect a video, not the entire url to youtube
source:
- Code: Select all
"http://www.youtube.com/v/http://www.youtube.com/watch?v=-EJnJqxl1-Y&feature=related"
that doesnt make sense
Re: php coding question

Posted:
Thu Jan 13, 2011 9:44 pm
by Dr Evil
yah I saw that and I fixed it, but still not playing
Re: php coding question

Posted:
Fri Jan 14, 2011 1:24 am
by Plague
It should be noted that the BBcodes can look for one of two things.
The URL that points to the video or just the video code.
This won't work generally.
http://www.youtube.com/watch?v=-EJnJqxl ... re=relatedthis would sometimes work.
http://www.youtube.com/watch?v=-EJnJqxl1-YYour BBCode is looking for just the video code,
-EJnJqxl1-Y
It completes the URL on its own.
Re: php coding question

Posted:
Fri Jan 14, 2011 6:43 am
by Dr Evil
I got it working, thanks for the support