P
P
Pototip2020-04-30 02:42:22
PHP
Pototip, 2020-04-30 02:42:22

Google map - infowindow in php?

There is a task for markers on the map to give infowindow but it does not work. Why is the map itself integrated into php. The link to give markers is obtained without problems.

Marker link code

echo 'let apt_' . $i . ' = {lat: ' . $lat . ', lng: ' . $lng . '};';
echo 'var marker_apt_' . $i . ' = new google.maps.Marker({
position: apt_' . $i . ',
map: map,
url: "' . $link . '",
label: {
text: "' . $price . ' ' .$current_currency.'",
color: "#fff",
fontSize: "9px",
},
icon: {
url: "' . get_template_directory_uri() . '/assets/images/svg/map-marker.svg",
scaledSize: new google.maps.Size(43, 20)
},
});

marker_apt_' . $i . '.addListener("click", function() {
window.location.href = marker_apt_' . $i . '.url });';

infowindow code

echo 'var marker_apt_' . $i . ' = new google.maps.Marker({
position: apt_' . $i . ',
map: map,
url: "' . $link . '",
label: {
text: "' . $price . ' ' .$current_currency.'",
color: "#fff",
fontSize: "9px",
},
icon: {
url: "' . get_template_directory_uri() . '/assets/images/svg/map-marker.svg",
scaledSize: new google.maps.Size(43, 20)
},
});

marker_apt_' . $i . '.addListener("click", function() {
infowindow.open = marker_apt_ });';


echo 'var infowindow' . $i . ' = new google.maps.InfoWindow({
content: "' . $i1 . '",
});';

Is my code correct? Has anyone experienced this and knows how to resolve it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question