• 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

AndreaMarucci

Well-known member
#1
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!
 

Brogan

XenForo moderator
Staff member
#2
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.
 

Mr Lucky

Well-known member
#4
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.png
 
Last edited:

Neal

Well-known member
#13
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: