Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
[SOLVED] Workaround possible instead of writing own plugin
Avatar
cziehr #1
Member since Jan 2011 · 532 posts · Location: 10119 Berlin
Group memberships: Members
Show profile · Link to this post
Subject: [SOLVED] Workaround possible instead of writing own plugin
Hello everyone,

I want to display a map on some of my wiki-pages (ok, that are more than only some pages, I will assume around 1500 - 2000).

I know about the openlayersmap-plugin, but this doesn't suit my needs. I want to use this code from leaflet:

<div id="mapid" style="width: 600px; height: 500px;"></div>
<script>

    var mymap = L.map('mapid').setView([<?php echo $lat ?>, <?php echo $lon ?>], 15);

    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        maxZoom: 18,
        attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
            '<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
        id: 'osm.streets'
    }).addTo(mymap);

    L.circle([<?php echo $lat ?>, <?php echo $lon ?>], 100, {
        color: 'red',
        fillColor: '#f03',
        fillOpacity: 0.3
    }).addTo(mymap).bindPopup("Text for tooltip.");
</script>

and on the different pages, there are always $lat and $lon which should be replaced by the given coordinates.

The pages are initally created by a script, so it would work to put the code with the coordinates replaced by the script between <HTML> and </HTML>, because HTML is activated (we will be a small group of 3 authors which trust each other).

But I don't like the way to put the whole code on every page, because if in the future there have to be changes to that code, I will have to touch every page.

The nicest solution would be a syntax plugin where I could type {{map&49.123&8.123}} to get a map with the two coordinates filled.

But does anybody has an idea if there is another way than writing an own plugin for this? I've already written two small plugins, but this is hard work for me and it would be great if my goal can be achieved on an easier way. The coordinates for every page are stored via the data-plugin, if this helps.

Alternativly, does someone know a very very simple syntax plugin which does nothing else than such a variable replace? I've searched many of the syntax plugins, but they all look so complicated.

Greetings,
Christoph
This post was edited on 2019-01-06, 00:33 by cziehr.
Avatar
cziehr #2
Member since Jan 2011 · 532 posts · Location: 10119 Berlin
Group memberships: Members
Show profile · Link to this post
I've tried to write a syntax-plugin for my problem and it was not really difficult. I've got now what I wanted. So this topic is solved. I'll post a link when my wiki is online with a demo.

I'm not sure if it makes sense to put the plugin on github, because it has a very special use case and I think I don't have the time and knowledge to make it usable for more wikis...
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-03-21, 23:21:16 (UTC +01:00)