XF 1.3 Custom BB Code

Clay Culver

Member
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.
 
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.webp
 

Attachments

Thanks for the help @Jake Bunce but I do seem to be having an issue. It is not displaying the inset image/card and seems to be adding the closing tag as part of the URL. See attached images I do have a dev board setup right now if you want to see it live (not sure the rules permit me to post the location)
 

Attachments

  • smurfy_1.webp
    smurfy_1.webp
    23.9 KB · Views: 33
  • smurfy_2.webp
    smurfy_2.webp
    36.6 KB · Views: 32
  • smurfy_3.webp
    smurfy_3.webp
    7.3 KB · Views: 32
  • smurfy_4.webp
    smurfy_4.webp
    22.3 KB · Views: 32
@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.
 
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/
 
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.
 
Top Bottom