XF 2.2 Embed MyRoute app maps

Yannis-GR

Member
Hi,

I would like to simply paste the embed code from MyRoute app website where my routes are created and stored and add them to my posts and get an image of the map instead of the link or a preview of the link like the image below.

1724883005514.webp

The result i am looking to receive is something like,

1724883130627.webp

The generated iframe is like the below,

1724883737992.webp


There is anyone who may done this for his forum or know how to do it and give me a hand to make the custom BBcode because I am pretty ignorant on how to build up the code?

Thanks,
 
And what the browser console says?
click F12 on you keyboard to open the dev tools and navigate to the console tab...

I just created the BB code with the settings you provided in the screenshot and it works well...

1724919235790.webp
 
Note that the exemple usage will be [MY_ROUTEAPP]9860974[/MY_ROUTEAPP]
In this way it works also to me!😃

But how I can build the code in order to simply paste the link and the. give the desired result?
I tried to make the code src={text}….but doesn’t work!
How should I make that part in order to be easier for the user to just paste the link and not the id of the link?
 
In this way it works also to me!😃
Did you manually wrote the BB code when you get the message error?
The BBcode you set up creates a button for the text editor, you must manually add it here /admin.php?button-manager/
Drag and drop, to be done for all versions of the text editor (XL, L, etc.):

Capture d'écran 2024-08-29 090121.webp

Capture d'écran 2024-08-29 090131.webp

So there is only the URL ID to enter manually, not the BB code

Capture d'écran 2024-08-29 090549.webp
 
Last edited:
How should I make that part in order to be easier for the user to just paste the link and not the id of the link?
You can ask to @JoshyPHP if he can help you create this multimedia BBcode or if he can integrate it into his add-on, which is also indispensable... or almost!
 
Did you manually wrote the BB code when you get the message error?
The BBcode you set up creates a button for the text editor, you must manually add it here /admin.php?button-manager/
Drag and drop, to be done for all versions of the text editor (XL, L, etc.):

View attachment 309860

View attachment 309861

So there is only the URL ID to enter manually, not the BB code

View attachment 309863
I have the map button in my editor but my mistake was to paste the link and not the URL ID.

What I would like to do is to let the users to paste the link like this,
1724924833341.webp
or like this,
1724924998913.webp

and get this result once posted,
1724925146282.webp
 
Thanks @JoshyPHP, although I'm not the OP I'm trying to make it work... for my personal culture.
So i used the regex you provided:
Code:
(^https?://www\.myrouteapp\.com/[\w/]+/(?'id'\d+)\b)i
And checked the PCRE option.

When i try to use the media BB code with this link: https://myrouteapp.com//embed/route/9860974

Capture d'écran 2024-08-29 174315.webp

This is the embed template i used:
HTML:
<iframe style="border:none;overflow:hidden" width="600" height="286" scrolling="no" frameborder="0" src="https://myrouteapp.com//embed/route/{$id}"></iframe>
 
To make the www. part optional, you'll need to use something like (^https?://(?:www\.)?myrouteapp\.com/[\w/]+/(?'id'\d+)\b)i

Looking at the site, though, that regexp will generate a lot of false positives. You'd need something more complex to support all of the routes URLs without accidentally trying to embed collections and profiles.
 
Back
Top Bottom