Opa,
I have a .php file with a while, where I get multiple records with addresses, this file is being called in an include in my index. The while prints several divs where within each has another div that is where the google map should be displayed, with the address marker.
The markers on the map are displayed perfectly if I start the javascript with fictitious coordinates placed in the index, but, how to indicate the real coordinates with data coming from a while and start the javascript, which are in an include? >
Javascript started in Index, beauty works.
google.maps.event.addDomListener(window, 'load', init);
function init() {
var locations = [
[40.6128,-73.9976, "images/pin-house.png", "estate-details-right-sidebar.html", "images/infobox-offer1.jpg", "Wall Street, Recife, BR", "R$120"]
];
offersMapInit("offers-map",locations);
mapInit(40.6128,-73.7903,"featured-map1","images/pin-house.png", false);
}
The .php file, which is included in the index:
<div class="featured-offers-container">
<div class="owl-carousel" id="featured-offers-owl">
<?php
$data_atual = date("Y-m-d");
$sql_lista=mysql_query(
"
SELECT
cidade.name AS cidade_nome,
empresa.nome
FROM
cidade, empresa
WHERE
id_cidade = cidade.id AND
empresa.nome = 'blablabla'
");
while($dados = mysql_fetch_array($sql_lista))
{
echo'
<div class="featured-offer-col">
<div class="featured-offer-front">
<div class="featured-offer-text">
<h4 class="featured-offer-title">'.$dados['nome'] .'</h4>
'.$dados['cidade_nome'] .'
<p>'.$dados['descricao'] .'</p>
</div>
</div>
<div class="featured-offer-back">
<div id="featured-map1" class="featured-offer-map"></div>
<div class="button">
<a href="estate-details-right-sidebar.html" class="button-primary">
<span>read more</span>
<div class="button-triangle"></div>
<div class="button-triangle2"></div>
<div class="button-icon"><i class="fa fa-search"></i></div>
</a>
</div>
</div>
</div>
';
}
?>
</div>
</div>
The map should be displayed in the 'featured-map1' div, as are several records, the name of this div should be dynamic, how does it relate to the javascript initialization?