XF 1.5 How to create a new BBCode

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
Code:
<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?

Thanks!
 
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.
 
I don't know about PHP callback either, but you could first of all try this and see if it works

Match URL:
Code:
google.com/maps/d/u/0/embed?mid={$id}

Embed html
Code:
<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.webp
 
Last edited:
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
hi.gif
 
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:
Top Bottom