Custom Google Search (CSE): how add the query string at the end of the result links? - google-custom-search

I'm looking for a way to configure Google Custom Search to append all search parameters to the generated urls of the search results so that on the target page the search parameters are known. E.g. if the query was "mot1 mot2" then something like "?keyword=mot1+mot2" should be appened to the page url.
If this is not possible, how can I determine the search query used to find a certain page so that I can highlight the search words on that page?
Here is my current script for Google Custom Search:
<script>
(function() {
var cx = 'xxx:xxxx';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
// AJOUT: Create a Custom Search Element
var options = {}
options[google.search.Search.RESTRICT_EXTENDED_ARGS] = {'as_sitesearch' : 'www.monsite.org/rep1/'};
var customSearchControl = new google.search.CustomSearchControl(cx, options);
})();
</script>
<gcse:search></gcse:search>
Thank's a lot ! ;-))

Whatever you are trying to do it would probably be best (and more reliably) achieved using Google CSE API.
Particularly, check out this answer to get some insight on how to use prefillQuery and execute methods to populate and trigger your customized query.
Nevertheless, if you don't need anything better, here is a quick and dirty solution for the standard setup:
(function() {
var cx = '017643444788069204610:4gvhea_mvga'; // Insert your own Custom Search engine ID here
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
function addExtraParams(){
var searchBoxWords = $("input.gsc-input").val().split(' '),
appendToQueryStr="";
for (i=0;i<searchBoxWords.length;i++){
appendToQueryStr+="&word"+i+"="+searchBoxWords[i];
}
setTimeout(
function(){
$("a.gs-title").each(function(){
$(this).attr(
"href",
$(this).attr("href")+appendToQueryStr
);
});
}
, 2000
);
};
$(document).ready(function(){
setTimeout(
function(){
$( 'input.gsc-input' ).keyup( function(e){
if ( e.keyCode == 13 ) {
addExtraParams();
}
});
$( 'input.gsc-search-button' ).click(function(){
addExtraParams();
});
}
, 1000
);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<gcse:search></gcse:search>
(The embedded snippet does not capture intro key, run the code on this fiddle for full functionality)
[EDIT] For your test of this code to work, you need to move the line where you load jQuery, so you'll get something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<div class="recherche">`enter code here`
<script type="text/javascript">
//var cx = '015556257213647319991:iyaymywao1c';
(function() {
var cx = '015556257213647319991:iyaymywao1c'; // Insert your own Custom Search engine ID here
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
function addExtraParams(){
var searchBoxWords = $("input.gsc-input").val().split(' '),
appendToQueryStr="";
for (i=0;i<searchBoxWords.length;i++){
appendToQueryStr+="&word"+i+"="+searchBoxWords[i];
}
setTimeout(
function(){
$("a.gs-title").each(function(){
$(this).attr(
"href",
$(this).attr("href")+appendToQueryStr
);
});
}
, 2000
);
};
$(document).ready(function(){
setTimeout(
function(){
$( 'input.gsc-input' ).keyup( function(e){
if ( e.keyCode == 13 ) {
addExtraParams();
}
});
$( 'input.gsc-search-button' ).click(function(){
addExtraParams();
});
}
, 1000
);
});
</script>
<gcse:search></gcse:search>
</div>
</body>
</html>

**To thank you I give for all my solution after many many search:**
-----------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>www.religare.org</title>
</head>
<body>
<style>
/* Affichage des url long pour les livres trouvés */
.gs-webResult.gs-result .gs-visibleUrl { display:block; }
.gs-webResult.gs-result .gs-visibleUrl-short { display:none; }
/* Barre de recherche Google */
#cse {
max-width:600px;
}
/* Enlever l'image du champ de saisie */
#gsc-i-id1 {
background-image: none !important;
}
</style>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script>
// ID de mon CSE (Custom Search Engine) personnalisé chez Google: https://cse.google.com/cse
var cx = 'xxx:xxxx';
// Création de la barre de recherche Google
(function() {
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
// Configuration de la recherche (utilise la librairie http://www.google.com/jsapi ci-dessus)
google.load('search', '1');
google.setOnLoadCallback(function(){
var customSearchOptions ={};
/* Add Custom Search Option: restrict directory */
customSearchOptions [google.search.Search.RESTRICT_EXTENDED_ARGS]={"as_sitesearch": "www.religare.org/livre/christianisme/"};
var customSearchControl = new google.search.CustomSearchControl(cx, customSearchOptions );
/* Add Custom Search Option: more result per page */
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
/* Add query addition: restrict filetype */
customSearchControl.setSearchStartingCallback( this, function(control, searcher, query) {
searcher.setQueryAddition("filetype:htm OR filetype:html");
}
);
}, true);
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
// Ajouter aux URL trouvées (TITRES et IMAGES) les mot-clés recherchés en paramètre ("?mot1=val1&mot2=val2") afin que les pages cibles puissent les surligner une fois ouvertes
function addExtraParams(){
var searchBoxWords = $("input.gsc-input").val().split(' '),
appendToQueryStr="";
separator="?";
for (i=0;i<searchBoxWords.length;i++){
appendToQueryStr+=separator+"mot"+i+"="+searchBoxWords[i];
separator="&";
}
// Pour chaque URL des TITRES trouvés: ajouter la chaine de recherche en paramètre (+vider liens data inutiles préemptant href)
$("a.gs-title").each(function(){
// On ne garde que la partie gauche de l'url avant le "?" (sans ses paramètres au cas où ils auraient déjà été ajoutés)
var searchURL = this.href.split('?');
$(this).attr("href", searchURL[0]+appendToQueryStr);
$(this).attr("data-cturl", "");
$(this).attr("data-ctorig", "");
});
// Pour chaque URL des IMAGES trouvées: ajouter la chaine de recherche en paramètre (+vider liens data inutiles préemptant href)
$("a.gs-image").each(function(){
// On ne garde que la partie gauche de l'url avant le "?" (sans ses paramètres au cas où ils auraient déjà été ajoutés)
var searchURL = this.href.split('?');
$(this).attr("href", searchURL[0]+appendToQueryStr);
$(this).attr("data-cturl", "");
$(this).attr("data-ctorig", "");
});
}
// Actualiser automatiquement (chaque 500ms) l'ajout des mot-clés recherchés en paramètre des URL trouvées
// (car les url de résultat ne seront générées par Google en asynchrones qu'après le submit du formulaire de recherche, et changent si on clic sur la pagination du résultat)
// Utilise la librairie (pour les appel avec $): https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
$(document).ready(function(){
setInterval(
function(){
addExtraParams();
} , 500 );
});
</script>
<div id="cse">Chargement de la barre de recherche Google en cours...</div>
<script type="text/javascript">
// Focus automatiquement sur le chp de recherche au chargement de la page
$(window).load( function() {
var input = $('#gsc-i-id1');
input.focus();
});
</script>
</body>
</html>

Related

Google map API isn't working

<!DOCTYPE html>
<?php
/* lat/lng data will be added to this array */
try{$work=$_GET["service"];}catch(Exception $e){echo 'Authorization Failed.Map may Misbehave or Buggy.Click here to report this';}
$locations=array();
$uname="root";
$pass="";
$servername="localhost";
$dbname="bcremote";
$db=new mysqli($servername,$uname,$pass,$dbname);
$query = $db->query('SELECT * FROM location');
while( $row = $query->fetch_assoc() ){
$name = $row['uname'];
$longitude = $row['longitude'];
$latitude = $row['latitude'];
$link=$row['link'];
/* Each row is added as a new array */
$locations[]=array( 'name'=>$name, 'lat'=>$latitude, 'lng'=>$longitude, 'lnk'=>$link );
}
//echo $locations[0]['name'].": In stock: ".$locations[0]['lat'].", sold: ".$locations[0]['lng'].".<br>";
//echo $locations[1]['name'].": In stock: ".$locations[1]['lat'].", sold: ".$locations[1]['lng'].".<br>";
?>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAfFN8NuvYyNkewBVMsk9ZNIcUWDEqHg2U&callback=initMap()"
async defer></script>
<script>
//var myLatLng = {lat: -25.363, lng: 131.044};
function initMap() {
var myLatLng = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
scrollwheel: false,
zoom: 10
});
<?php for($i=0;$i<sizeof($locations);$i++)
{ ?>
var marker = new google.maps.Marker({
map: map,
position: {lat: <?php echo $locations[$i]['lat']?>,lng: <?php echo $locations[$i]['lng']?>},
title: 'Service',
url: 'https://<?php echo $locations[$i]['lnk']?>'
});
google.maps.event.addListener(marker, 'click', function() {
window.location.href = marker.url;
});
<?php } ?>
}
</script>
<body>
<div id="map"></div>
</body>
I have a Code like this. I think don't have any Errors in code side may be in Logic Side. Please help me to over come this. I need to submit this Project within next 2 Days.May I know how to fix this Issue?
With Advanced Thanks,
Kavin
It seems that the Problem was with Google Map Key and the way that I handled it. Now it works perfectly. Once I have updated it, It started Working. The Code is also changed with a Help of GitHub Repository.
<?php
$locations=array();
$work=$_GET["service"];
$uname="root";
$pass="";
$servername="localhost";
$dbname="bcremote";
$db=new mysqli($servername,$uname,$pass,$dbname);
$query = $db->query("SELECT * FROM location where work='$work'");
//$number_of_rows = mysql_num_rows($db);
//echo $number_of_rows;
while( $row = $query->fetch_assoc() ){
$name = $row['uname'];
$longitude = $row['longitude'];
$latitude = $row['latitude'];
$link=$row['link'];
/* Each row is added as a new array */
$locations[]=array( 'name'=>$name, 'lat'=>$latitude, 'lng'=>$longitude, 'lnk'=>$link );
}
//echo $locations[0]['name'].": In stock: ".$locations[0]['lat'].", sold: ".$locations[0]['lng'].".<br>";
//echo $locations[1]['name'].": In stock: ".$locations[1]['lat'].", sold: ".$locations[1]['lng'].".<br>";
?>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAfFN8NuvYyNkewBVMsk9ZNIcUWDEqHg2U"></script>
<script type="text/javascript">
var map;
var Markers = {};
var infowindow;
var locations = [
<?php for($i=0;$i<sizeof($locations);$i++){ $j=$i+1;?>
[
'AMC Service',
'<p>Book this Person Now</p>',
<?php echo $locations[$i]['lat'];?>,
<?php echo $locations[$i]['lng'];?>,
0
]<?php if($j!=sizeof($locations))echo ","; }?>
];
var origin = new google.maps.LatLng(locations[0][2], locations[0][3]);
function initialize() {
var mapOptions = {
zoom: 9,
center: origin
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
infowindow = new google.maps.InfoWindow();
for(i=0; i<locations.length; i++) {
var position = new google.maps.LatLng(locations[i][2], locations[i][3]);
var marker = new google.maps.Marker({
position: position,
map: map,
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][1]);
infowindow.setOptions({maxWidth: 200});
infowindow.open(map, marker);
}
}) (marker, i));
Markers[locations[i][4]] = marker;
}
locate(0);
}
function locate(marker_id) {
var myMarker = Markers[marker_id];
var markerPosition = myMarker.getPosition();
map.setCenter(markerPosition);
google.maps.event.trigger(myMarker, 'click');
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<body id="map-canvas">

Worry in the backoffice of my module undefined index prestashop

I developed a prestashop module, when I am in the backoffice of my module, I have many with errors:
Notice à la ligne 30 du fichier
C:\xampp2\htdocs\projet_presta\app\cache\dev\smarty\compile\86\1c\1c\861c1cb1906b13002a1460e54203e8a370598366.file.displayContent.tpl.php
[8] Undefined index: avisnote Notice à la ligne 30 du fichier
C:\xampp2\htdocs\projet_presta\app\cache\dev\smarty\compile\86\1c\1c\861c1cb1906b13002a1460e54203e8a370598366.file.displayContent.tpl.php
[8] Trying to get property of non-object
in my module avisnote.php file:
public function displayContent()
{
$avisnote = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'avisnote` LIMIT 1');
print_r($avisnote);
foreach ($avisnote as $row)
{
$file = $row['url'];
$state = $row['etat'];
}
if(isset($fileContent) && !empty($fileContent))
{
$fileContent = file_get_contents($file, NULL, NULL);
$var_sep = explode(";", $fileContent);
$nb_avis = $var_sep[0];
$note = $var_sep[1];
$this->context->$smarty->assign('avisnote',
array('nb_avis' => $nb_avis,
'note'=>$note,
'etat'=>$state));
}
return $this->display(__FILE__,'views/templates/hook/displayContent.tpl');
}
the paths of my files:
avisnote.php : Modules/avisnote/
displayContent.tpl : Modules/avisnote/views/templates/hook/
displayContent.tpl:
<p></p>
<div itemprop="itemreviewed" itemscope="" itemtype="http://data-vocabulary.org/Review-aggregate">
<span itemprop="itemreviewed">Mywebsite</span> <span itemprop="rating" itemscope="" itemtype="http://data-vocabulary.org/Rating"> <span itemprop="average">{$avisnote.note}</span> sur <span itemprop="best">5</span> </span>
<br />basé sur <span itemprop="votes">{$avisnote.nb_avis}</span> avis Avis Vérifiés</div>
</div>
You have at least 2 errors in your code.
First you check if isset($fileContent) then use the variable $file. Second, you have $this->context->$smarty ... Your code fixed should be more like:
public function displayContent()
{
$avisnote = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'avisnote` LIMIT 1');
print_r($avisnote);
foreach ($avisnote as $row)
{
$file = $row['url'];
$state = $row['etat'];
}
$nb_avis = $note = $state = '';
if(isset($file) && !empty($file))
{
$fileContent = file_get_contents($file, NULL, NULL);
$var_sep = explode(";", $fileContent);
$nb_avis = $var_sep[0];
$note = $var_sep[1];
}
$this->context->smarty->assign('avisnote',
array('nb_avis' => $nb_avis,
'note'=>$note,
'etat'=>$state));
return $this->display(__FILE__,'views/templates/hook/displayContent.tpl');
}

Image upload with phonegap and windows8 not working like on android

I am trying to upload a photo captured with phonegap using filetransfer;I managed with android , but it doesn't work on windows 8, in fact the problem I see is due to the url of the image; under android is file ://url but on Windows 8 it is something kind of blob:1234566778rerui2, help me plz, here is the code
<!DOCTYPE html>
<html>
<head>
<title>Exemple de transfert de fichier</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Attendre que PhoneGap soit prêt
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap est prêt
//
function onDeviceReady() {
// Récupérer l'URI d'un fichier image à partir de la source spécifiée
navigator.camera.getPicture(uploadPhoto,
function(message) { alert('Echec de récupération du fichier'); },
{ quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY }
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, "http://un.serveur.com/upload.php", win, fail, options);
}
function win(r) {
console.log("Code = " + r.responseCode);
console.log("Réponse = " + r.response);
console.log("Envoyé = " + r.bytesSent);
}
function fail(error) {
alert("Une erreur est survenue : Code = " = error.code);
}
</script>
</head>
<body>
<h1>Exemple</h1>
<p>Transfert de fichier</p>
</body>
</html>
we have to change on the corodova.js for windows 8 because there is a bug there , you can check this link: https://groups.google.com/forum/#!topic/phonegap/h2k-GeBJ0kY

Multiple Bing Map Pushpins from SQL not showing in Firefox & Chrome but do in IE

I'm displaying a Bing Map (v7) in my Webmatrix2 website with a series of pushpins & infoboxes drawn from a SQL Express database using a JSON enquiry.
While the maps appears in all 3 browsers I'm testing (IE, FF & Chrome) the pushpins are sometimes not showing in FF & Chrome, particularly if I refresh with Cntrl+F5
This is my first JSON and Bing Maps app so expect there's a few mistakes.
Any suggestions on how to improve the code and get display consistency?
#{
Layout = "~/_MapLayout.cshtml";
}
<script type="text/javascript" src="~/Scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<link rel="StyleSheet" href="infoboxStyles.css" type="text/css">
<script type="text/javascript">
var map = null;
var pinLayer, pinInfobox;
var mouseover;
var pushpinFrameHTML = '<div class="infobox"><a class="infobox_close" href="javascript:closeInfobox()"><img src="/Images/close2.jpg" /></a><div class="infobox_content">{content}</div></div><div class="infobox_pointer"><img src="images/pointer_shadow.png"></div>';
var pinLayer = new Microsoft.Maps.EntityCollection();
var infoboxLayer = new Microsoft.Maps.EntityCollection();
function getMap() {
map = new Microsoft.Maps.Map(document.getElementById('map'), {
credentials: "my-key",
zoom: 4,
center: new Microsoft.Maps.Location(-25, 135),
mapTypeId: Microsoft.Maps.MapTypeId.road
});
pinInfobox = new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(0, 0), { visible: false });
AddData();
}
$(function AddData() {
$.getJSON('/ListSchools', function (data) {
var schools = data;
$.each(schools, function (index, school) {
for (var i = 0; i < schools.length; i++) {
var pinLocation = new Microsoft.Maps.Location(school.SchoolLat, school.SchoolLon);
var NewPin = new Microsoft.Maps.Pushpin(pinLocation);
NewPin.title = school.SchoolName;
NewPin.description = "-- Learn More --";
pinLayer.push(NewPin); //add pushpin to pinLayer
Microsoft.Maps.Events.addHandler(NewPin, 'mouseover', displayInfobox);
}
});
infoboxLayer.push(pinInfobox);
map.entities.push(pinLayer);
map.entities.push(infoboxLayer);
});
})
function displayInfobox(e) {
if (e.targetType == "pushpin") {
var pin = e.target;
var html = "<span class='infobox_title'>" + pin.title + "</span><br/>" + pin.description;
pinInfobox.setOptions({
visible: true,
offset: new Microsoft.Maps.Point(-33, 20),
htmlContent: pushpinFrameHTML.replace('{content}', html)
});
//set location of infobox
pinInfobox.setLocation(pin.getLocation());
}
}
function closeInfobox() {
pinInfobox.setOptions({ visible: false });
}
function getCurrentLocation() {
var geoLocationProvider = new Microsoft.Maps.GeoLocationProvider(map);
geoLocationProvider.getCurrentPosition();
}
</script>
<body onload="getMap();">
<div id="map" style="position:relative; width:800px; height:600px;"></div>
<div>
<input type="button" value="Find Nearest Schools" onclick="getCurrentLocation();" />
</div>
</body>
The JSON file is simply
#{
var db = Database.Open("StarterSite");
var sql = #"SELECT * FROM Schools WHERE SchoolLon != ' ' AND SchoolLon != 'null' ";
var data = db.Query(sql);
Json.Write(data, Response.Output);
}
Add your pinLayer, infobox, and infoboxLayer before calling the AddData function and see if that makes a difference. Also verify that school.SchoolLat and school.SchoolLon are numbers and not a string version of a number. If they are a string, then use parseFloat to turn them into a number. Other than that everything looks fine.

Google Maps and Yelp API mash-up doesn't work with some searchterms

I am currently working on a webapplication mashing up the Yelp and Google Maps API's. I finished the code and it seemed to be working until I found out that google maps won't show up with certain searchterms. For example when I search for Pizza in Denver my app works perfectly, but when i search for Sushi in New York, Google Maps just doesn't load. I checked my source code after doing the search and the results are all there. I can't seem to figure out what's the problem. The app is online .
The Google Maps code snippet:
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
//Er word een kaart neergezet
function initialize(lat,lon,label) {
var lancenter =
"<?
echo $latitude_center
?>";
var loncenter =
"<?
echo $longitude_center
?>";
var map;
var mapOptions = {
zoom: 12,
center: new google.maps.LatLng(lancenter, loncenter),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
var map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
var companyLogo = new google.maps.MarkerImage('image.png',
new google.maps.Size(35,60),
new google.maps.Point(0,0),
new google.maps.Point(18,60)
);
var companyShadow = new google.maps.MarkerImage('shadow.png',
new google.maps.Size(69,60),
new google.maps.Point(0,0),
new google.maps.Point(18,60)
);
<?
//Er word een loop gemaakt die de array met resultaten doorloopt en vervolgens markers, infowindows en beschrijving op de kaart plaatst voor alle resultaten.
while($i<sizeof($response["businesses"])) {
$latitude_result = $response["businesses"][$i]["location"]["coordinate"]["latitude"];
$longitude_result = $response["businesses"][$i]["location"]["coordinate"]["longitude"];
$result_description = $response["businesses"][$i]["name"];
$result_rating = $response["businesses"][$i]["rating_img_url_small"];
$result_ratingnr = $response["businesses"][$i]["review_count"];
$result_beschrijving = $response["businesses"][$i]["snippet_text"];
$result_beschrijving=str_replace("\n"," ",$result_beschrijving);
$result_beschrijving=str_replace("\r"," ",$result_beschrijving);
$result_adres0 = $response["businesses"][$i]["location"]["display_address"][$i];
$result_adres1 = $response["businesses"][$i]["location"]["display_address"]["1"];
$result_adres2 = $response["businesses"][$i]["location"]["display_address"]["2"];
$result_adres3 = $response["businesses"][$i]["location"]["display_address"]["3"];
$result_image = $response["businesses"][$i]["image_url"];
$result_url = $response["businesses"][$i]["url"];
$result_image = $result_image ? $result_image : 'noimg.gif';
$result_beschrijving = $result_beschrijving ? $result_beschrijving : 'Er is helaas geen beschrijving beschikbaar voor deze locatie.';
?>
var lanresult =
"<?
echo $latitude_result
?>";
var lonresult =
"<?
echo $longitude_result
?>";
var resultloc = new google.maps.LatLng(lanresult, lonresult);
var beschrijving =
'<h3>'+"<?
echo "<div id='container'>",Naam,":"," ","<h2>", $result_description,"</h2>","</br>",Beschrijving,":"," ","<h2>", $result_beschrijving,"<a href='", $result_url,"' target='_new'>","Lees verder","</a>","</h2>","</br>", Adres,":"," ","<h2>", $result_adres0,"</br>", $result_adres1,"</h2>","</br>", Waardering,":"," ","<img src='", $result_rating,"'/>","<h2>",$result_ratingnr," ",recensies,"</h2>","</br>","<img src='", $result_image,"'/>","</br>","</br>","<h2>","<a href='", $result_url,"' target='_new'>","Lees meer informatie via YELP","</a>","</h2>","</div>"
?>";'</h3>'
var marker<? echo $i; ?> = new google.maps.Marker({
map: map,
icon: companyLogo,
shadow: companyShadow,
position: resultloc,
});
var infowindow<? echo $i; ?>= new google.maps.InfoWindow({
content: beschrijving,
maxWidth: 260
});
google.maps.event.addListener(marker<? echo $i; ?>, 'click', function() {
infowindow<? echo $i; ?>.open(map,marker<? echo $i; ?>);
});
<?
$i++;
} // einde while php
?>
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
I really hope someone can help me.
Kind Regards