Marker description showing twice

Phoca Maps - displaying maps in Joomla! CMS
yuberlin
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 07 May 2010, 17:37

Marker description showing twice

Post 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>';
jernej
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 05 Jul 2010, 18:16

Re: Marker description showing twice

Post by jernej »

I have the same problem. The description shows up in multiple markes. Makes the markers pretty much useless, any ideas?
jernej
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 05 Jul 2010, 18:16

Re: Marker description showing twice

Post 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.
yuberlin
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 07 May 2010, 17:37

Re: Marker description showing twice

Post 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>';
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9132
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: Marker description showing twice

Post by Benno »

Well done! :twisted:
Kind regards,
Benno
Post Reply