Page 1 of 1

Marker description showing twice

Posted: 24 Jun 2010, 11:45
by yuberlin
I have a map with two markers. The first marker shows in info window:

Marker 1 Headline
Bla
Bla
Bla

The second Marker shows:

Marker 1 Headline
Bla
Bla
Bla

Marker 2 Headline
Bla
Bla
Bla


It seems that the plugin is loading every marker description in second marker window, not only the one set in the marker.
Why is that an how can i fix it?

Heres my phocamaps.php (plugin) that i changed previously for displaying images in marker description properly (removed "addslashes" in $text and commented out displaying the title):

Code: Select all

// Markers
		jimport('joomla.filter.output');
		if (isset($markerp) && !empty($markerp)) {
		
			$iconArray = array(); // add information about created icons to array and check it so no duplicity icons js code will be created
			foreach ($markerp as $key => $markerV) {
			
				if ((isset($markerV->longitude) && $markerV->longitude != '')
				&& (isset($markerV->latitude) && $markerV->latitude != '')) {
					
					
					//$text = '>' . addslashes($markerV->title) . '</h1>';
					$text .= '<div>'. PhocaMapsHelper::strTrimAll($markerV->description).'</div>';
					if ($markerV->displaygps == 1) {
						$text .= '<div class="pmgps"><table border="0"><tr><td><strong>'. JText::_('GPS') . ': </strong></td>'
								.'<td>'.PhocaMapsHelper::strTrimAll(addslashes($markerV->gpslatitude)).'</td></tr>'
								.'<tr><td></td>'
								.'<td>'.PhocaMapsHelper::strTrimAll(addslashes($markerV->gpslongitude)).'</td></tr></table></div>';
					}
					
					
					if(empty($markerV->icon)) {
						$markerV->icon = 0;
					}
					if(empty($markerV->title)){
						$markerV->title = '';
					}
					if(empty($markerV->description)){
						$markerV->description = '';
					}
					
					$iconOutput = $map->setMarkerIcon($markerV->icon);
					if (!in_array($markerV->icon, $iconArray)) {	
						$output .= $iconOutput['js'];
						$iconArray[] = $markerV->icon;
					}
					$output .= $map->setMarker($markerV->id,$markerV->title,$markerV->description,$markerV->latitude, $markerV->longitude, $iconOutput['icon'], $iconOutput['iconid'], $text, $markerV->contentwidth, $markerV->contentheight,  $markerV->markerwindow );
					
				}
			}
		}

		if ($tmpl['load_kml']) {
			$output .= $map->setKMLFile($tmpl['load_kml']);
		}
		
		if ($tmpl['displaydir']) {
			$output .= $map->setDirectionDisplayService('phocaDir');
		}
		$output .= $map->setListener();
		$output .= $map->endMapFunction();

		if ($tmpl['displaydir']) {
			$output .= $map->setDirectionFunction($tmpl['display_print_route'], $mapp->id, $mapp->alias, $tmpl['lang']);
		}
		
		$output .= $map->setInitializeFunction();
	$output .= $map->endJScData();
}


$output .= '<div style="clear:both"></div>';
$output .= '</div>';

Re: Marker description showing twice

Posted: 05 Jul 2010, 18:18
by jernej
I have the same problem. The description shows up in multiple markes. Makes the markers pretty much useless, any ideas?

Re: Marker description showing twice

Posted: 06 Jul 2010, 01:26
by jernej
Managed to solve it.

Find the file phocamaps.php in "plugins/content/" and remove the line 367:

Code: Select all

$text .= '<div>'. PhocaMapsHelper::strTrimAll(addslashes($markerV->description)).'</div>';
This will cause the title to appear every time, so remove the line 326 in phocamapsmap.php ( administrator/components/com_phocamaps/helpers):

Code: Select all

$text .=  '<h1>' . addslashes($title) . '</h1>';
If you don't want the titles to appear ofcourse.

Re: Marker description showing twice

Posted: 14 Jul 2010, 10:18
by yuberlin
...And if you want to show images in description change in phocamapsmap.php:

Code: Select all

$text .= '<div>'. PhocaMapsHelper::strTrimAll(addslashes($description)).'</div>';
to

Code: Select all

$text .= '<div>'. PhocaMapsHelper::strTrimAll($description).'</div>';

Re: Marker description showing twice

Posted: 14 Jul 2010, 11:13
by Benno
Well done! :twisted:
Kind regards,
Benno