how to create a link to a google map position

eric258

Member
hello,

hoping that it is not in the scope of professional help....

i have been working hard on restyling the div template... but there is one thing that i just cant do ...
i have an icon on the template, i would like that when they click on it, it takes them to the location on a map
all addresses are geocoded and all clubs are on a visualisation map Could you help me in achieving this?

upload_2016-11-12_10-23-7.png
 
hi troester ,
i am having trouble creating that query could you please post some example?

my website is chessbook.net
i dont know how to write the query to include the long and lat and zoom i have pasted a sc of my db structure
upload_2016-11-12_19-49-29.png
 
hi troester ,
i am having trouble creating that query could you please post some example?

my website is chessbook.net
i dont know how to write the query to include the long and lat and zoom i have pasted a sc of my db structure
View attachment 15235

the reason i am lost is that those bracket are coming into the string and i just cant get rid of them
i would understand that if you were not wiling to help but if anyone here know how to create such a string i ll be happy
 
ok i ve managed to get it to work, opted for the google map option as my visualisation map has 1500 markers on it and took too long to load.
if you are interested here is my default_row.php lot of trimming required to pull the data needed of the db...

PHP:
<?php
/**
* Fabrik List Template: Div Row
* Note the div cell container is now generated in the default template
* in FabrikHelperHTML::bootstrapGrid();
*
* @package     Joomla
* @subpackage  Fabrik
* @copyright   Copyright (C) 2005-2016  Media A-Team, Inc. - All rights reserved.
* @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
*/

// No direct access
defined('_JEXEC') or die('Restricted access');

?>
<div id="<?php echo $this->_row->id;?>" class="<?php echo $this->_row->class;?>">
<div style="clear: both;">
</div>
<?php
    $array = explode(',', trim($this->_row->data->chess_clubs___club_webpage_raw, '{}'));
    foreach($array as $item) {
        $parts = explode('":"', trim($item, '"'));
        $web_array[$parts[0]] = $parts[1];
    }
    $logo = $this->_row->data->chess_clubs___logo_du_club_raw;
    if(is_null($logo) || $logo == '') { $logo = '/images/stories/nologo.png'; }
?>
<div style="float:left;width:10%;text-transform:capitalize;"><?php echo $this->_row->data->chess_clubs___flag;?></div>
<div style="float:right;width:87%;">
    <h4>
        <?php echo $this->_row->data->chess_clubs___club;?>
        <?php if($web_array['link'] != 'http://') { ?><a href="<?= $web_array['link']; ?>" title="Visit their Page!" target="_blank"><?php } ?>
            <img style="border: 0px solid ; width: 60px;  height: 60px; position: absolute; top: 0px; right: 2px" class="img-circle" src="<?= $logo; ?>" />
        <?php if($web_array['link'] != 'http://') { ?></a><?php } ?>
    </h4>
    <div  style="width: 100%;position: absolute; left: 0px; text-transform: capitalize; list-style-type: none; margin-left:0px; padding-left:0px; display: inline-block; ">
        <?php echo $this->_row->data->chess_clubs___street_name;?> <?php echo $this->_row->data->chess_clubs___post_code;?> <?php echo $this->_row->data->chess_clubs___city;?>
    </div>
</div>

<div  style="width: 182px; float: left;">

</div>

<div  style="float: left; width: 210px; padding-right: 10px;">
<div>

</div>

</div>

<div style="clear: both;">

</div>

<div style="clear: both; margin-top: 50px;">
<div style=" float: left; width: 280px;">

<a href="<?php echo $this->_row->data->chess_clubs___email_raw;?>"><img style="border: 0px solid ; width: 20px; height: 20px;" alt="Email" src="http://chessbook.net/ZULUTESTINGSITE/images/email.png" align="left">&nbsp; Contact the club</a>
</div>
<div  style="width: 280px; float: left;">
<a href="#"><img style="border: 0px solid ; width: 20px; height: 20px;" alt="Email" src="http://www.clker.com/cliparts/M/0/7/s/T/o/orange-phone-hi.png" align="left">&nbsp; <?php echo $this->_row->data->chess_clubs___phone_raw;?></a>
</div>
<div  style="width: 280px; float: left;">
<?php
$myVar = $this->_row->data->chess_clubs___clubmap_raw;
$myVar = ltrim($myVar, '(');
$myVar = str_replace(' ', '', $myVar);
$myVar = explode(')', $myVar);
// $myVar[0] = Coordinates
// $myVar[1] = zoom
?>
<a href="http://maps.google.com/maps?q=loc:<?=$myVar[0]; ?>&z=<?= $myVar[1]; ?>" target="_blank" title="view on google map"><img style="position: absolute; top: 130px; right: 16px; border: 0px solid ; width: 30px; height: 30px;" src="http://www.chessbook.net/ZULUTESTINGSITE/images/chess.png" align="left"></a>
</div>
</div>

</div>

and here is the results

upload_2016-11-14_18-7-1.png
page can be seen in action here http://www.chessbook.net/ZULUTESTINGSITE/index.php/chess-clubs/club-directory
 
Last edited:
Personally I'd do that in a calc element rather than in the template.

Bust up your map element string using the FabrikString::mapStrToCoords($mapstring, $default_zoom) helper, which returns an object with lat, lon and zoom in it.

Code:
$coords = FabrikString::mapStrToCoords('{yourtable___yourmapelement}', '12');

... the use $coords->lat, $coords->lon and $coords->zoom to build your link to google maps, and return that. Then it'll just be another element you can use anywhere, without having to put more code in the templates.

The default zoom is only used in if the map string has no zoom, which is a legacy thing, they should now all have a zoom level.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top