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

XF 1.5 How to create a new BBCode

Discussion in 'Styling and Customization Questions' started by AndreaMarucci, Nov 5, 2015.

  1. AndreaMarucci

    AndreaMarucci Well-Known Member

    I'm not a coder so I'm trying to understand how to do that. I've this code to embed a google map in a message
    <iframe src="https://www.google.com/maps/d/u/0/embed?mid=zHVkoyIZEGOs.koLosDTtM_IE" width="100%" height="450"></iframe>
    so how can I create a new BBCode to do that? There's someone willing to help me?

  2. Brogan

    Brogan XenForo Moderator Staff Member

    You extract the portion of code which is different for each embed, presumably the zHVkoyIZEGOs.koLosDTtM_IE

    You then replace that in the original code with {$id} and create a corresponding match URL.

    Have a look how it's done for the bb code media sites.

    I haven't looked into whether it's possible to do it with a basic bb code or not - it may require a PHP callback.
  3. AndreaMarucci

    AndreaMarucci Well-Known Member

    Thanks Brogan, too advanced for me. I don't even know what is a PHP callback :unsure:
  4. Mr Lucky

    Mr Lucky Well-Known Member

    I don't know about PHP callback either, but you could first of all try this and see if it works

    Match URL:
    Embed html
    <p><iframe src="https://www.google.com/maps/d/u/0/embed?mid={$id}" width="100%" height="450"></iframe></p>
    So your custom BBcode will look a bit like this:
    Screen Shot 2015-11-05 at 14.01.16.png
    Last edited: Nov 5, 2015
    Neal, matt vinyl and AndreaMarucci like this.
  5. Mr Lucky

    Mr Lucky Well-Known Member

    I just tested it, yes it works, no PHP callback
  6. AndreaMarucci

    AndreaMarucci Well-Known Member

    Thank you very very much. I'll try now...
  7. AndreaMarucci

    AndreaMarucci Well-Known Member

    WOW!!! It works!!!! THanks!
  8. matt vinyl

    matt vinyl Member

    Been looking at this for around four weeks now and I must have totally missed this thread. Did as you suggested @Mr Lucky and Bingo!!!
    You sir are great person. Thank you [​IMG]
  9. Mkenya

    Mkenya Member

    Why this does work in my forum
  10. Mr Lucky

    Mr Lucky Well-Known Member

    Why shouldn't it?
  11. Mkenya

    Mkenya Member

    i have done everything per instruction on this picture
  12. Mr Lucky

    Mr Lucky Well-Known Member

    That should work.
  13. Neal

    Neal Well-Known Member

    Just doing a test and i'm getting "The specified URL cannot be embedded as media". I am correct in just adding the ID of the location to the media embed?

    EDIT: I've also tried the full URL given by Google Maps.

    I have located the location ID via developers.google.com - ChIJVz2S8EKQe0gRy-Rzziio6k8
    Last edited: Mar 28, 2016

Share This Page