News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Cyling/Run Route BBCodes

Started by dimspace, May 02, 2013, 02:06:10 PM

Previous topic - Next topic

dimspace

This will have a fairly limited audience, but bbcodes for embedding rides from garmin, mapmyride etc...

Currently done: Garmin, MapmyRide and Endomondo, working on Strava and others.

Be aware this uses iframe embedding so I dont know if there could be any security risk as far as html goes..

in subs.php
find
);

// Let mods add new BBC without hassle.

Add before
array(
'tag' => 'garmin',
'before' => '<iframe width="465" height="548" frameborder="0" src="http://connect.garmin.com:80/activity/embed/',
'after' => '"></iframe>',
),
array(
'tag' => 'mapmyride',
'before' => '<iframe id="mapmyfitness_route" src="http://snippets.mapmycdn.com/routes/view/embedded/',
'after' => '?width=560&height=400&elevation=true&info=true&line_color=E6a67031&rgbhex=3170a6&distance_markers=0&unit_type=imperial&map_mode=TERRAIN&last_updated=2007-09-09T21:27:27+01:00" height="590px" width="100%" frameborder="0"></iframe>',
),
array(
'tag' => 'endomondo',
'before' => '<iframe src=http://www.endomondo.com/embed/workouts?w=',
'after' => '&width=580&height=600" width="580" height="600" frameborder="0" scrolling="no" ></iframe>',
),


in subs.editor.php (at the relevant point where you want the icons to appear

array(
'image' => 'garmin',
'code' => 'garmin',
'before' => '[garmin]',
'after' => '[/garmin]',
'description' => $txt['bbc_garmin']
),
array(
'image' => 'mapmyride',
'code' => 'mapmyride',
'before' => '[mapmyride]',
'after' => '[/mapmyride]',
'description' => $txt['bbc_mapmyride']
),
array(
'image' => 'endomondo',
'code' => 'endomondo',
'before' => '[endomondo]',
'after' => '[/endomondo]',
'description' => $txt['bbc_endomondo']
),


in modifications.english.php
$txt['bbc_garmin'] = 'Insert a Garmin activity ID';
$txt['bbc_mapmyride'] = 'Insert a Map my Ride activity ID';
$txt['bbc_endomondo'] = 'Insert an Endomondo rider and activity id for example 184353320/9925838';


in the bbc directory of theme/images the attached icons..

Useage..

Garmin - simply enter the workout id (numeric) in the bbcode
Map my ride - enter the workout id (numeric) in the bbcode
Endomondo - enter the user/activity code ie 184353320/9925838

Obviously limited useage, but useful to those sports forums that want users to be able to share their rides by embedding.

dimspace


Mick.


dimspace

Bikemap and Ridewithgps

in subs.php
array(
'tag' => 'ridewithgps',
'before' => '<iframe src="http://ridewithgps.com/routes/',
'after' => '/embed" height="500px" width="100%" frameborder="0"></iframe>',
),
array(
'tag' => 'bikemap',
'before' => '<div style="background-color:#fff;"><iframe src="http://bikemap.net/en/route/',
'after' => '/widget/?width=425&amp;extended=1&amp;height=350&amp;unit=metric" width="425" height="663" border="0" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe></div>',
),


in subs-editor.php
array(
'image' => 'bikemap',
'code' => 'bikemap',
'before' => '[bikemap]',
'after' => '[/bikemap]',
'description' => $txt['bbc_bikemap']
),
array(
'image' => 'ridewithgps',
'code' => 'ridewithgps',
'before' => '[ridewithgps]',
'after' => '[/ridewithgps]',
'description' => $txt['bbc_ridewithgps']
),

In modifications.eng/utf8
$txt['bbc_bikemap'] = 'Insert a Bikemap route in the format 1493880-putevima-cvijeca';
$txt['bbc_ridewithgps'] = 'Insert a Ride with GPS activity ID';


images



(Why cant you attach things in this section)

TheListener

Is this limited to the US?

Reason being where I live we have what we call redways which basically are red paths which are not near roads.

These were intended for use by pedestrians and cycles.

http://en.wikipedia.org/wiki/Milton_Keynes_redway_system

dimspace

all the mapping sites i have added so far, are global sites with a multitude of routes.. So depends if anyone has mapped the MK Routes.

Looking at the site, it appears that much like MK itself, the red routes are a spaghetti assortment sprawling across the entire city (got very lost trying to get into MK once ):D Will have a dig around and see if anyone has mapped them yet..

TheListener

Milton Keynes Redway may be a good search term.

;)

Anyways Dr Who and my stomach are waiting.

dimspace

Just had a look.. A user has created a bunch of MK routes on bikemap.

Heritage Trail A - citywide

Heritage Trail B - North East

Heritage Trail B - Olney Spur

Heritage Trail C - Ouzal Valley

Heritage Trail D - Southwest loop

Heritage Trail D - Northwest Loop

all those can be embedded using the full embed code if you have html access, or the bb code without using the format
710210-mk-heritage-trail-d-mk-west-northern-loop

Mick.

@dim, you should package this  :P

dimspace

Quote from: Mick. on May 12, 2013, 02:17:15 PM
@dim, you should package this  :P

That would involve learning how to package mods.. :D Im far too lazy for all that. Maybe when ive finished bugfixing my smf installation :D

TheListener

Quote from: dimspace on May 12, 2013, 02:33:43 PM
Quote from: Mick. on May 12, 2013, 02:17:15 PM
@dim, you should package this  :P

That would involve learning how to package mods.

Best left to the experts I say.

:D

Arantor

Eh, packaging mods isn't hard. The hard part really is writing the code in the first place.

dimspace

I think the audience for those who want to embed running or cycling routes in their posts is probably fairly limited..

Packing is the easy bit, it would be interesting to learn how to package a mod, the difficult bit is then having the patience to offer support, update it, answer silly questions like "it says 2.0.3 will it work on 2.0.4" and the like. In no time at all I would have turned into a grumpy old man.

Arantor

QuoteIn no time at all I would have turned into a grumpy old man.

OMG someone gets me.

dimspace


TheListener

I had a go on my test forum.

The package installed with no errors.

However there wer no bbc images.

(Default theme was used).

dimspace

#16
Quote from: Old Fossil on May 21, 2013, 01:57:47 PM
I had a go on my test forum.

The package installed with no errors.

However there wer no bbc images.

(Default theme was used).

hmm.. maybe i set it up to extract wrong.. there should be a bunch of images go to the bbc directory.. well im half way there. :D

ive got
<modification>install.xml</modification>
<require-dir name="bbc" destination="$themedir/images/" />


Maybe that should read
<modification>install.xml</modification>
<require-dir name="/bbc" destination="$themedir/images/" />


hmmm... hang on.. they are all .png, maybe they need to be gif for bbc?

TheListener

Ya gonna have to ask one of the coder types lol.


Arantor

No, you were right the first time with what you had. The thing is that it doesn't always install to other themes because of a combination between the inadequacies of the package manager and the way the bbc editor works.

Mind you, I have absolutely no idea why your editor edits are supposed to drop iframes directly into the posting area because unless you did something else, they will be processed out and never displayed (which is why you use bbcode instead anyway)

dimspace

Quote from: Arantor on May 21, 2013, 06:11:29 PM
No, you were right the first time with what you had. The thing is that it doesn't always install to other themes because of a combination between the inadequacies of the package manager and the way the bbc editor works.
Does png v gif make a difference, it occured to me afterwards that not everyones smf has png bb icons, or is it smart enough to find them?

Quote from: Arantor on May 21, 2013, 06:11:29 PM
Mind you, I have absolutely no idea why your editor edits are supposed to drop iframes directly into the posting area because unless you did something else, they will be processed out and never displayed (which is why you use bbcode instead anyway)

Youve lost me? I dont know quite what you mean. The purpose of it is to allow members to put for instance [garmin]486135[/garmin] and it embed the iframe of that route as supplied by garmin without them using embed or html codes (but i think you get that), so i dont quite get what you mean.

Im new at this :D

code now something like

Package info
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<name>Run/Ride BBC</name>
<id>dimspace:RunRideBBC</id>
<version>1.0</version>
<type>modification</type>

<install for="2.0 - 2.0.99">
<modification>install.xml</modification>
<require-file name="bbc/garmin.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/mapmyride.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/bikemap.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/endomondo.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/ridewithgps.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/tracks4bikers.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/garmin.png" destination="$imagesdir/bbc" />
<require-file name="bbc/mapmyride.png" destination="$imagesdir/bbc" />
<require-file name="bbc/bikemap.png" destination="$imagesdir/bbc" />
<require-file name="bbc/endomondo.png" destination="$imagesdir/bbc" />
<require-file name="bbc/ridewithgps.png" destination="$imagesdir/bbc" />
<require-file name="bbc/tracks4bikers.png" destination="$imagesdir/bbc" />
</install>

<uninstall for="2.0 - 2.0.99">
<modification reverse="true">install.xml</modification>
<require-file name="bbc/garmin.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/mapmyride.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/bikemap.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/endomondo.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/ridewithgps.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/tracks4bikers.gif" destination="$imagesdir/bbc" />
<require-file name="bbc/garmin.png" destination="$imagesdir/bbc" />
<require-file name="bbc/mapmyride.png" destination="$imagesdir/bbc" />
<require-file name="bbc/bikemap.png" destination="$imagesdir/bbc" />
<require-file name="bbc/endomondo.png" destination="$imagesdir/bbc" />
<require-file name="bbc/ridewithgps.png" destination="$imagesdir/bbc" />
<require-file name="bbc/tracks4bikers.png" destination="$imagesdir/bbc" />

</uninstall>

</package-info>


install
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>nikan:EUCookie</id>
<version>1.0</version>

<file name="$sourcedir/Subs.php">
<operation>
<search position="before"><![CDATA[
array(
'tag' => 'i',
'before' => '<em>',
'after' => '</em>',
),
]]></search>
<add><![CDATA[
array(
'tag' => 'garmin',
'before' => '<iframe width="465" height="548" frameborder="0" src="http://connect.garmin.com:80/activity/embed/',
'after' => '"></iframe>',
),
array(
'tag' => 'mapmyride',
'before' => '<iframe id="mapmyfitness_route" src="http://snippets.mapmycdn.com/routes/view/embedded/',
'after' => '?width=560&height=400&elevation=true&info=true&line_color=E6a67031&rgbhex=3170a6&distance_markers=0&unit_type=imperial&map_mode=TERRAIN&last_updated=2007-09-09T21:27:27+01:00" height="590px" width="100%" frameborder="0"></iframe>',
),
array(
'tag' => 'endomondo',
'before' => '<iframe src=http://www.endomondo.com/embed/workouts?w=',
'after' => '&width=580&height="600" width="580" height="600" frameborder="0" scrolling="no" ></iframe>',
),
array(
'tag' => 'ridewithgps',
'before' => '<iframe src="http://ridewithgps.com/routes/',
'after' => '/embed" height="500px" width="100%" frameborder="0"></iframe>',
),
array(
'tag' => 'tracks4bikers',
'before' => '<iframe width="600" height="740" src="http://tracks4bikers.com/tracks/show_iframe/',
'after' => '"></iframe>',
),
array(
'tag' => 'bikemap',
'before' => '<div style="background-color:#fff;"><iframe src="http://bikemap.net/en/route/',
'after' => '/widget/?width=425&amp;extended=1&amp;height=350&amp;unit=metric" width="425" height="663" border="0" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe></div>',
),
]]></add>
</operation>
</file>

<file name="$sourcedir/Subs-Editor.php">
<operation>
<search position="before"><![CDATA[
array(
'image' => 'quote',
'code' => 'quote',
'before' => '[quote]',
'after' => '[/quote]',
'description' => $txt['bbc_quote']
),
]]></search>
<add><![CDATA[
array(),
array(
'tag' => 'garmin',
'before' => '<iframe width="465" height="548" frameborder="0" src="http://connect.garmin.com:80/activity/embed/',
'after' => '"></iframe>',
),
array(
'tag' => 'mapmyride',
'before' => '<iframe id="mapmyfitness_route" src="http://snippets.mapmycdn.com/routes/view/embedded/',
'after' => '?width=560&height=400&elevation=true&info=true&line_color=E6a67031&rgbhex=3170a6&distance_markers=0&unit_type=imperial&map_mode=TERRAIN&last_updated=2007-09-09T21:27:27+01:00" height="590px" width="100%" frameborder="0"></iframe>',
),
array(
'tag' => 'endomondo',
'before' => '<iframe src=http://www.endomondo.com/embed/workouts?w=',
'after' => '&width=580&height="600" width="580" height="600" frameborder="0" scrolling="no" ></iframe>',
),
array(
'tag' => 'ridewithgps',
'before' => '<iframe src="http://ridewithgps.com/routes/',
'after' => '/embed" height="500px" width="100%" frameborder="0"></iframe>',
),
array(
'tag' => 'tracks4bikers',
'before' => '<iframe width="600" height="740" src="http://tracks4bikers.com/tracks/show_iframe/',
'after' => '"></iframe>',
),
array(
'tag' => 'bikemap',
'before' => '<div style="background-color:#fff;"><iframe src="http://bikemap.net/en/route/',
'after' => '/widget/?width=425&amp;extended=1&amp;height=350&amp;unit=metric" width="425" height="663" border="0" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"> </iframe></div>',
),
array(),
]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.english.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['bbc_ridewithgps'] = 'Insert a Ride with GPS route ID';
$txt['bbc_tracks4bikers'] = 'Insert a Tracks 4 Bikers route ID';
$txt['bbc_garmin'] = 'Insert a Garmin activity ID';
$txt['bbc_bikemap'] = 'Insert a Bikemap route in the format 1493880-putevima-cvijeca';
$txt['bbc_mapmyride'] = 'Insert a Map my Ride activity ID';
$txt['bbc_endomondo'] = 'Insert an Endomondo rider and activity id for example 184353320/9925838';
]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.english-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['bbc_ridewithgps'] = 'Insert a Ride with GPS route ID';
$txt['bbc_tracks4bikers'] = 'Insert a Tracks 4 Bikers route ID';
$txt['bbc_garmin'] = 'Insert a Garmin activity ID';
$txt['bbc_bikemap'] = 'Insert a Bikemap route in the format 1493880-putevima-cvijeca';
$txt['bbc_mapmyride'] = 'Insert a Map my Ride activity ID';
$txt['bbc_endomondo'] = 'Insert an Endomondo rider and activity id for example 184353320/9925838';
]]></add>
</operation>
</file>
<require-dir name="bbc" destination="$sourcedir/images/" />

</modification>


And then bbc folder with all images as png and gif????

Advertisement: