1. 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

Discussion in 'Troubleshooting and Problems' started by Clay Culver, Apr 12, 2014.

  1. Clay Culver

    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.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Clay Culver

    Clay Culver Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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
     

    Attached Files:

    Clay Culver likes this.
  5. Clay Culver

    Clay Culver Member

    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)
     

    Attached Files:

  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    @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.
     
    Clay Culver likes this.
  7. Clay Culver

    Clay Culver Member

    ha! it works now, thanks for all the help @Jake Bunce ! Also feel silly for not realizing how it was coded (been too long since i have done much coding).
     
  8. MichaelCS

    MichaelCS Member

    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/
     
  9. Tracy Perry

    Tracy Perry Well-Known Member

    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.
     
  10. MichaelCS

    MichaelCS Member

    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.
     

Share This Page