Linking Place to an anchor

  • wmegerton
  • Topic Author
  • Visitor
  • Visitor
5 years 4 months ago - 5 years 4 months ago #5010 by wmegerton
Linking Place to an anchor was created by wmegerton
I am in the process of converting my website from Mike Reumer's GoogleMaps extension, sadly no longer supported, to GMapFP. In the previous implementation, I had a map at the top of the page, with markers which linked by means of anchor points to larger photographs and details further down the same page. I have discovered that GMapFP is able to do this by, firstly by adding the photographs and details (with anchor points) below the map by means of a Personalisation, and then by inserting the full URL with anchor point into the Link box on the Place Manager page, as for example "suttonpoyntz.org.uk/index.php/creating-m...sutton-rd-n#IMG_0777". As this link is to the same page, it would be both simpler and more portable to be able to enter the link as a bare anchor, as for example "#IMG_0777".

I have modified the code in /components/com_gmapfp/libraries/map_v3.php on my website to make this possible. The modification is very simple. Where variable $map_link is created, I have added the instruction $link1=substr(trim($row->link),0,1); to obtain the first character of the link, and then I have added the test ||($link1=="#") twice further down so that the anchor link is used, with $choix set to 0. The complete code at this point therefore becomes:
$link1=substr(trim($row->link),0,1);
$link4=substr(trim($row->link),0,4);
$link5=substr(trim($row->link),0,5);
$link9=substr(trim($row->link),0,9);
$linkmap=trim($row->link);

if ($link4=="www.") {$linkmap="http://".$linkmap;};

if ((empty($row->link))||($row->link='')) {
if(!class_exists('GMapFPHelperRoute')) require_once (JPATH_SITE . '/components/com_gmapfp/helpers/route.php');
if ($config->get('target')==0) {
// $map_link=JRoute::_('index.php?option=com_gmapfp&view=gmapfp&Itemid='.$itemid.'&layout=article&tmpl=component&id='.$row->id, false);
$map_link=JRoute::_(GMapFPHelperRoute::getArticleRoute($row->slug).'&tmpl=component', false);
}else{
// $map_link=JRoute::_('index.php?option=com_gmapfp&view=gmapfp&Itemid='.$itemid.'&layout=article&id='.$row->slug, false);
$map_link=JRoute::_(GMapFPHelperRoute::getArticleRoute($row->slug), false);
};
$choix=1;
} else {
if (($link5=="http:")||($link4=="www.")||($link1=="#")||($link9=="index.php")) {
$map_link=$linkmap;
if (($link5=="http:")||($link4=="www.")||($link1=="#")) {$choix=0;}else{$choix=1;};
} else {
if(!class_exists('ContentHelperRoute')) require_once (JPATH_SITE . '/components/com_content/helpers/route.php');
if ($config->get('target')==0) {
$map_link=JRoute::_(ContentHelperRoute::getArticleRoute($row->article_slug, $row->article_id.':'.$row->article_alias, 0));
$map_link .= '?&tmpl=component';
}else{
$map_link=JRoute::_(ContentHelperRoute::getArticleRoute($row->article_slug, $row->article_id.':'.$row->article_alias, 0));
};
$choix=1;
};
};
If you think this modification might be of general value, perhaps you might consider incorporating it into a future release.

I apologise that my French is no longer good enough to be able to write this in French.
With thanks,
Bill Egerton
Last edit: 5 years 4 months ago by wmegerton. Reason: Minor correction

Please Log in or Create an account to join the conversation.

Time to create page: 0.151 seconds
Powered by Kunena Forum
FaLang translation system by Faboba