latitude = $lat; $this->longitude = $lon; // Set the info window HTML $this->html = $html; if (count($options) > 0) { foreach ($options as $option => $value) { // Set marker options if (in_array($option, $this->valid_options, true)) $this->options[] = "$option:$value"; } } } public function render($tabs = 0) { // Create the tabs $tabs = empty($tabs) ? '' : str_repeat("\t", $tabs); // Marker ID $marker = 'm'.++self::$id; $output[] = 'var '.$marker.' = new google.maps.Marker(new google.maps.LatLng('.$this->latitude.', '.$this->longitude.'), {'.implode(",", $this->options).'});'; if ($html = $this->html) { $output[] = 'google.maps.Event.addListener('.$marker.', "click", function()'; $output[] = '{'; $output[] = "\t".$marker.'.openInfoWindowHtml('; $output[] = "\t\t'".implode("'+\n\t\t$tabs'", explode("\n", $html))."'"; $output[] = "\t);"; $output[] = '});'; } $output[] = 'map.addOverlay('.$marker.');'; return implode("\n".$tabs, $output); } } // End Gmap Marker