1
Opa,
I have a file . php with a while, where I return several records with addresses, this file is being called in a include in my index. while prints multiple Ivs where inside each has another div which is where the google map should be displayed, with the address Marker.
The markers on the map are displayed perfectly if I start javascript with fictitious coordinates placed on the index, but how to indicate the real coordinates with data coming from a while and start javascript, and this data is in a include?
Javascript started on Index, works beauty.
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 div 'featured-map1', as there are several records, the name of this div I believe should be dynamic, as it relates to the javascript initialization?
Put in the code, it would be easier to understand.
– Ricardo