Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
[SOLVED] Workaround possible instead of writing own plugin
cziehr #1
Member since Jan 2011 · 576 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>

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

    L.tileLayer('https://{s}{z}/{x}/{y}.png', {
        maxZoom: 18,
        attribution: 'Map data &copy; <a href="">OpenStreetMap</a> contributors, ' +
            '<a href="">CC-BY-SA</a>',
        id: 'osm.streets'
    }).addTo(mymap);[<?php echo $lat ?>, <?php echo $lon ?>], 100, {
        color: 'red',
        fillColor: '#f03',
        fillOpacity: 0.3
    }).addTo(mymap).bindPopup("Text for tooltip.");

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.

This post was edited on 2019-01-05, 23:33 by cziehr.
cziehr #2
Member since Jan 2011 · 576 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
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-06-17, 02:59:05 (UTC +02:00)