Skip Navigation

[Résolu] Trying to implement a Leaflet Maps plugin

This support ticket is created Il y a 6 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Marqué : ,

Ce sujet contient 4 réponses, a 3 voix.

Dernière mise à jour par romanB-3 Il y a 6 années.

Assisté par: Nigel.

Auteur
Publications
#1165443

I am trying to: implement a Leaflet Maps plugin

Link to a page where the issue can be seen:

I expected to see: Many Markers

Instead, I got: No Markers

Dear Toolsetters,

Since I am suffering from a GAFA allergy and for reasons of data protection (GRDP-Regulations), I try to implement a Leaflet Maps plugin -lien caché) - to bridge, until You offer a suitable alternative. My choice fell on this plugin because it is very simple and markers can be set using shortcodes. And so I hope to make them dynamic with the help of your tools.

I have registered the shortcodes in your settings and it is possible to display a map in a single content template and set a dynamic marker with a code like this:

For the Map:
[leaflet-map address = "[types field = 'zipcode' format = 'FIELD_VALUE'] [/ types] [types field = 'place name'] [/ types]" zoom = "10"]

For the Marker:
[leaflet-marker address = "[types field = 'street'] [/ types], [types field = 'place name'] [/ types]" svg = "1" background = "# 654" iconClass = "dashicons dashicons- marker "color =" white "]

So far so good.

What I have failed so far is to run the marker shortcode in a view item loop. What I want to achieve, of course, is to dynamically generate the markers that belong to a View and show them together on the map. Like that

(Marker 1)
[leaflet-marker address = "[types field = 'street'] [/ types], [types field = 'place name'] [/ types]" svg = "1" background = "# 654" iconClass = "dashicons dashicons- marker "color =" white "]

(Marker2)
[leaflet-marker address = "[types field = 'street'] [/ types], [types field = 'place name'] [/ types]" svg = "1" background = "# 654" iconClass = "dashicons dashicons- marker "color =" white "]

etc.

If possible: Can you help me with this?

Best Regards
Achim

#1165601

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Achim

We are aware of certain demand from clients to provide an alternative to Google or Azure maps; it is under consideration, but is not being currently worked on, so I can't say with any confidence if and when it will.

As we don't support leaflet maps, there is not much I can do to help, I'm afraid.

It's not obvious to my why it would work with a single marker on a map in a content template, but not for multiple markers output by a View.

If each post in your View query has one address field, the looping over the posts and outputting the address is effectively the same as displaying a single address in a content template.

Maybe your leaflet-marker shortcode needs an ID or similar to uniquely identify them.

If in a content template you add multiple leaflet-marker shortcodes with different addresses do they work?

That's just a thought, as I say we don't support it I'm afraid.

#1166246
chrome-Javascript-bug-information.jpg

Hello Nigel,
Thank you for your kind answer. Yes, multiple markers work well in a content template.

When the markers go through the loop, a Jave Script error is displayed: Uncaught SyntaxError: Invalid or unexpected token.
I have copy-paced the appropriate part from the Chrome Inspector (See the attached file). Reference is made to line 314, respectively (and each corresponding line of the ongoing loop)
I do not know if this information is illuminating. Anyway, the output shows that the markers go through the loop.

Maybe more of a problem where Leaflet Maps Plugin Maker can help?

Best regards
Achim

#1166297

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+00:00)

Hi Achim

I took a quick look and tried the same, installing the Leaflet Map plugin and trying to output a map with multiple markers in a View, but came across the same JS errors (which look as if they arise because of HTML encoding of the JS that the plugin inserts with the marker shortcode).

I'm sorry I don't have any advice about fixing that, it is not something we support. (If it was a very popular plugin we could look at identifying the cause, but it is not.)

#1194004

Hello,
I am having exact same problem.
achimK-2, dit you find a solution ?
Thank you.