• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Custom BB Code

#1
Hi,

Now that I own a license for xF I am trying to get the custom bb code working. My initial thread about this is http://xenforo.com/community/threads/custombb-question.70211/ that thread has screen shots on the error I have been getting (the same one with 1.3.1). @Jeremy pointed out it could require a PHP callback, but I am unsure how to do it this way.

This is the code used for phpbb3
Code:
<iframe src="http://mwo.smurfy-net.de/tools/mechtooltip?i={SIMPLETEXT1}&l={SIMPLETEXT2}"width="100%" height="300" border="0"></iframe>
Any help would be appreciated.
 

Jake Bunce

XenForo moderator
Staff member
#4
Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: smurfy

Site Title: Smurfy

Site URL: http://mwo.smurfy-net.de/

Match URLs: #http://mwo\.smurfy-net\.de/mechlab\#(?P<id>i=[0-9]+&l=[a-z0-9]+)$#siU

Embed HTML:

Code:
<see callback>
Then under Advanced Options:

Use 'Match URLs' as PCRE regular expressions: (checked)

URL Match Callback: MediaSites_Smurfy::extractParams

Embed HTML Callback: MediaSites_Smurfy::buildEmbed

And you need to upload the attached file to this location:

library/MediaSites/Smurfy.php

URLs tested:
http://mwo.smurfy-net.de/mechlab#i=69&l=48564e5dd58d23cf227aaf53c17c33ec2326552f

Result:

Screen shot 2014-04-13 at 9.48.52 PM.png
 

Attachments

Jake Bunce

XenForo moderator
Staff member
#6
@Clay Culver

You just need to post the URL itself. The parser will automatically match the URL and construct the BB Code which is actually:


[media=smurfy]69|48564e5dd58d23cf227aaf53c17c33ec2326552f[/media]


The system won't let you pass the entire URL in the BB code, so I programmed the callback to extract only the needed values when you post the URL.
 
#8
Admin CP -> Home -> BB Code Media Sites -> Add BB Code Media Site

Media Site ID: smurfy

Site Title: Smurfy

Site URL: http://mwo.smurfy-net.de/

Match URLs: #http://mwo\.smurfy-net\.de/mechlab\#(?P<id>i=[0-9]+&l=[a-z0-9]+)$#siU

Embed HTML:

Code:
<see callback>
Then under Advanced Options:

Use 'Match URLs' as PCRE regular expressions: (checked)

URL Match Callback: MediaSites_Smurfy::extractParams

Embed HTML Callback: MediaSites_Smurfy::buildEmbed

And you need to upload the attached file to this location:

library/MediaSites/Smurfy.php

URLs tested:
http://mwo.smurfy-net.de/mechlab#i=69&l=48564e5dd58d23cf227aaf53c17c33ec2326552f
What if you are running SSL?

SSL blocks this code from displaying?

https://www.mechspecs.com/index.php?threads/kfx-p-brawler-fox-3x-cerml-1x-cuac5-cecm.6713/
 
#10
Only choice... don't use SSL or have the other site install a certificate on their site. Browsers will not allow displaying of insecure content in an iframe on a secure connection.
Wow, and if I disable SSL on those pages it will break the login for XenForo. Grrrrr, I will have to see about asking him to install a certificate.