php coding question

Show off new creations, get help, or just chat about all aspects of web development and design.

php coding question

Postby Dr Evil on Wed Jan 12, 2011 2:58 pm

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}-:.
User avatar
Dr Evil
1337 p0st3r
1337 p0st3r
 
Joined: Sun Dec 12, 2010 7:22 pm
Location: Youngstown, Ohio

Re: php coding question

Postby Dr Evil on Wed Jan 12, 2011 10:05 pm

*gentle bump*
User avatar
Dr Evil
1337 p0st3r
1337 p0st3r
 
Joined: Sun Dec 12, 2010 7:22 pm
Location: Youngstown, Ohio

Re: php coding question

Postby zombie@computer on Thu Jan 13, 2011 9:37 am

I can give advise about coding in terms of syntax, but i dont know anything about punbb.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: php coding question

Postby ROFLhacks on Thu Jan 13, 2011 1:54 pm

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>
Fortune tellers make a killing nowadays
ROFLhacks
Regular
Regular
 
Joined: Thu Jun 10, 2010 10:07 pm

Re: php coding question

Postby Dr Evil on Thu Jan 13, 2011 4:07 pm

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=416

I 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 :(
User avatar
Dr Evil
1337 p0st3r
1337 p0st3r
 
Joined: Sun Dec 12, 2010 7:22 pm
Location: Youngstown, Ohio

Re: php coding question

Postby zombie@computer on Thu Jan 13, 2011 4:18 pm

'<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
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: php coding question

Postby Dr Evil on Thu Jan 13, 2011 4:37 pm

Well, that sorta worked... but now I get just a big while box

http://www.thestkclan.net/forums/viewto ... pid=73#p73
User avatar
Dr Evil
1337 p0st3r
1337 p0st3r
 
Joined: Sun Dec 12, 2010 7:22 pm
Location: Youngstown, Ohio

Re: php coding question

Postby zombie@computer on Thu Jan 13, 2011 9:09 pm

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&amp;feature=related"


that doesnt make sense
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: php coding question

Postby Dr Evil on Thu Jan 13, 2011 9:44 pm

yah I saw that and I fixed it, but still not playing
User avatar
Dr Evil
1337 p0st3r
1337 p0st3r
 
Joined: Sun Dec 12, 2010 7:22 pm
Location: Youngstown, Ohio

Re: php coding question

Postby Plague on Fri Jan 14, 2011 1:24 am

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=related
this would sometimes work.
http://www.youtube.com/watch?v=-EJnJqxl1-Y

Your BBCode is looking for just the video code,
-EJnJqxl1-Y

It completes the URL on its own.
Contact. The EU welcomes the pain free. That's emotional impact.
I actually think limitation is good for creativity. If we had an engine that could do everything, we would be in trouble. It gives us focus. ~~ Randy Lundeen
User avatar
Plague
Veteran
Veteran
 
Joined: Tue Jun 22, 2010 7:12 pm

Re: php coding question

Postby Dr Evil on Fri Jan 14, 2011 6:43 am

I got it working, thanks for the support
User avatar
Dr Evil
1337 p0st3r
1337 p0st3r
 
Joined: Sun Dec 12, 2010 7:22 pm
Location: Youngstown, Ohio

Return to Web Design & Development

Who is online

Users browsing this forum: No registered users