Hi
I forgot to say this was a simple test (and it works for me) - but obviously, we need to pass ALL the map parameters (rather than my simple 2 parameter test) to the googlemap joomla plug-in.
What we are doing is importing a joomla plugin and then triggering the googlemap plugin with the $dispatcher->trigger call (as if it were standard Joomla article content).
I need to complete the mod this week and I am very happy to post the updated K2dynamap.php file if anyone wants this.
No credit to me - all I did was make a simple modification to the great work from Nick and Frank to allow Mike's fantastic plugin to operate on the K2 content.
Mark Beddis said:
Hi Stavros
Thanks for the reply.
In case anyone else is looking for a solution, what I have done is mododify Nicks great component.
I did some experimenting and realised that with some minor code changes I could use the great Joomla plugin from Mike Reumer at
tech.reumer.net/ in conjunction with Nicks in place of the single article call.
I installed Mikes GogleMaps plugin (see
extensions.joomla.org/extensions/1147/details)
I then modified the file K2dynamap.php file located in plugins/k2in the region of line 89 to call Mikes googlemap plugin as follows:
if ($view == 'item') { $plugins = new K2Parameter($item->plugins, '', $this->pluginName); $latitude = trim($plugins->get('latitude', '')); $longitude = trim($plugins->get('longitude', '')); $hidemap = $plugins->get('hidemap', 0); if ((!$hidemap) && ($latitude != "") && ($longitude != "")) { $marker = $plugins->get('marker', ''); $color = $plugins->get('color', 'red'); $zoom = $plugins->get('zoom', 12); $width = $plugins->get('width', 400); $height = $plugins->get('height', 200); $type = $plugins->get('type', 'roadmap'); //$popuptxt = $plugins->get('popuptxt'); - Not needed here.. used only by K2 DynaMap Module /* Marks comment out */ //$output = '<br />'; //$output .= '<center><img src="
maps.google.com/maps/api/staticmap?center='.$latitude.','.$longitude.'&zoom='.$zoom.'&size='.$width.'x'.$height.'&maptype='.$type.'&markers=color:'.$color.'|label:'.$marker.'|'.$latitude.','.$longitude.'&sensor=false"/></center>'; $output = '<br />'; $output .= '<center>'; $output .= "{mosmap width='500'|height='400'|lat='".$latitude."'|lon='".$longitude."'| zoom='3'|zoomType='Large'|zoomNew='0'|mapType='Satellite'|showMaptype='1'|overview='0'|text='sv DWO'|tooltip='DWO'|marker='1'|align='center'}"; $output .= '</center>'; /* Marks Edit */ $o = new stdClass(); $o->text = $output; JPluginHelper::importPlugin('content'); $dispatcher = & JDispatcher::getInstance(); $results = $dispatcher->trigger('onPrepareContent', array (&$o, array(), 0)); $output = $o->text; } }
Hope this helps someone
Regards
Mark
Stavros said:
You have to wait the new version of
nick.texidor.com/
Great job ;)