Advertisement

Linking the MapSearch 2.0 plugin to the RouteViewer 3.0 plugin and/or the PoiViewer 2.0 plugin

By default, the MapSearch plugin links back to the RouteYou website. However, when you use both the MapSearch and RouteViewer / PoiViewer plugins on your website, you will want to change this behaviour.

Step 1: MapSearch

In the MapSearch plugin, you need to change the URL to which routes and/or places of interest will link.

Your configuration object will now, for example, look like this:

RTY.MapSearch.load({
        'token': '<your RouteYou web service token>',
        'language': '<your language>',
        ...
        'route.view.link': 'https://www.mywebsite.com/routeview?route-id=%id%',
        'poi.view.link': 'https://www.mywebsite.com/poiview?poi-id=%id%'
    });

Or with the iframe version:

<iframe src="//plugin.routeyou.com/mapsearch/basic/?token=<your RouteYou web service token>&amp;language=<your language>&amp;route.view.link=https%3A%2F%2Fwww.mywebsite.com%2Frouteview%3Froute-id%3D%25id%25&amp;poi.view.link=https%3A%2F%2Fwww.mywebsite.com%2Fpoiview%3Fpoi-id%3D%25id%25" width="800" height="500" frameborder="0" allowfullscreen></iframe>

Step 2: RouteViewer / PoiViewer

For the RouteViewer and PoiViewer plugin, you need to extract the route / place of interest ID from the URL.

If you use this convenience method, your configuration object will now, for example, look like this:

RTY.RouteViewer.load({
        'token': '<your RouteYou web service token>',
        'language': '<your language>',
        ...
        'params.route.id': parseInt(RTY.Util.Uri.getQueryParameter('route-id'), 10)
    });
RTY.PoiViewer.load({
        'token': '<your RouteYou web service token>',
        'language': '<your language>',
        ...
        'params.poi.id': parseInt(RTY.Util.Uri.getQueryParameter('poi-id'), 10)
    });

Or with the iframe version:

<iframe src="//plugin.routeyou.com/routeviewer/basic/?token=<your RouteYou web service token>&amp;language=<your language>&amp;params.route.id=<route ID>" width="800" height="500" frameborder="0" allowfullscreen></iframe>
<iframe src="//plugin.routeyou.com/poiviewer/basic/?token=<your RouteYou web service token>&amp;language=<your language>&amp;params.poi.id=<POI ID>" width="800" height="500" frameborder="0" allowfullscreen></iframe>

Back to RouteYou

© 2006-2024 RouteYou - www.routeyou.com