script
Tuesday, November 27, 2012
Friday, November 2, 2012
Google map with larger number of markers
Copy and paste following code in html file
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
</head>
<body>
<div id="map" style="width:600px;height:400px;"></div>
<div id="messages"></div>
<script type="text/javascript">
//<![CDATA[
// delay between geocode requests - at the time of writing, 100 miliseconds seems to work well
var delay = 0;
// ====== Create map objects ======
var infowindow = new google.maps.InfoWindow();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var geo = new google.maps.Geocoder();
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var bounds = new google.maps.LatLngBounds();
// ====== Geocoding ======
function getAddress(search, next) {
geo.geocode({address:search}, function (results,status)
{
// If that was successful
if (status == google.maps.GeocoderStatus.OK) {
// Lets assume that the first marker is the one we want
var p = results[0].geometry.location;
var lat=p.lat();
var lng=p.lng();
// Output the data
var msg = 'address="' + search + '" lat=' +lat+ ' lng=' +lng+ '(delay='+delay+'ms)<br>';
document.getElementById("messages").innerHTML += msg;
// Create a marker
createMarker(search,lat,lng);
}
// ====== Decode the error status ======
else {
// === if we were sending the requests to fast, try this one again and increase the delay
if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
nextAddress--;
//delay++;
} else {
var reason="Code "+status;
var msg = 'address="' + search + '" error=' +reason+ '(delay='+delay+'ms)<br>';
document.getElementById("messages").innerHTML += msg;
}
}
next();
}
);
}
// ======= Function to create a marker
function createMarker(add,lat,lng) {
var contentString = add;
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lat,lng),
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
bounds.extend(marker.position);
}
// ======= An array of locations that we want to Geocode ========
var addresses = [
'Junagadh',
'ribda',
'vadal',
'porbandar',
'rajkot',
'bhavnagar',
'dholka',
'surat',
'amdavad',
'surat',
'vadodara',
'valsad',
'himmatnagar',
'narmada',
'dholka',
'chotila',
'bagodara',
];
// ======= Global variable to remind us what to do next
var nextAddress = 0;
// ======= Function to call the next Geocode operation when the reply comes back
function theNext() {
if (nextAddress < addresses.length) {
setTimeout('getAddress("'+addresses[nextAddress]+'",theNext)', delay);
nextAddress++;
} else {
// We're done. Show map bounds
map.fitBounds(bounds);
}
}
// ======= Call that function for the first time =======
theNext();
// This Javascript is based on code provided by the
// Community Church Javascript Team
// http://www.bisphamchurch.org.uk/
// http://econym.org.uk/gmap/
//]]>
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
</head>
<body>
<div id="map" style="width:600px;height:400px;"></div>
<div id="messages"></div>
<script type="text/javascript">
//<![CDATA[
// delay between geocode requests - at the time of writing, 100 miliseconds seems to work well
var delay = 0;
// ====== Create map objects ======
var infowindow = new google.maps.InfoWindow();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var geo = new google.maps.Geocoder();
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var bounds = new google.maps.LatLngBounds();
// ====== Geocoding ======
function getAddress(search, next) {
geo.geocode({address:search}, function (results,status)
{
// If that was successful
if (status == google.maps.GeocoderStatus.OK) {
// Lets assume that the first marker is the one we want
var p = results[0].geometry.location;
var lat=p.lat();
var lng=p.lng();
// Output the data
var msg = 'address="' + search + '" lat=' +lat+ ' lng=' +lng+ '(delay='+delay+'ms)<br>';
document.getElementById("messages").innerHTML += msg;
// Create a marker
createMarker(search,lat,lng);
}
// ====== Decode the error status ======
else {
// === if we were sending the requests to fast, try this one again and increase the delay
if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
nextAddress--;
//delay++;
} else {
var reason="Code "+status;
var msg = 'address="' + search + '" error=' +reason+ '(delay='+delay+'ms)<br>';
document.getElementById("messages").innerHTML += msg;
}
}
next();
}
);
}
// ======= Function to create a marker
function createMarker(add,lat,lng) {
var contentString = add;
var marker = new google.maps.Marker({
position: new google.maps.LatLng(lat,lng),
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
bounds.extend(marker.position);
}
// ======= An array of locations that we want to Geocode ========
var addresses = [
'Junagadh',
'ribda',
'vadal',
'porbandar',
'rajkot',
'bhavnagar',
'dholka',
'surat',
'amdavad',
'surat',
'vadodara',
'valsad',
'himmatnagar',
'narmada',
'dholka',
'chotila',
'bagodara',
];
// ======= Global variable to remind us what to do next
var nextAddress = 0;
// ======= Function to call the next Geocode operation when the reply comes back
function theNext() {
if (nextAddress < addresses.length) {
setTimeout('getAddress("'+addresses[nextAddress]+'",theNext)', delay);
nextAddress++;
} else {
// We're done. Show map bounds
map.fitBounds(bounds);
}
}
// ======= Call that function for the first time =======
theNext();
// This Javascript is based on code provided by the
// Community Church Javascript Team
// http://www.bisphamchurch.org.uk/
// http://econym.org.uk/gmap/
//]]>
</script>
</body>
</html>
Friday, October 19, 2012
get labels from locallang file in typo3
function getLabels()
{
$markerArray = array();
$basePath = 'EXT:' . $this->extKey . '/' . dirname($this->scriptRelPath) . '/locallang.xml';
$languageArray = $this->LOCAL_LANG = t3lib_div::readLLfile($basePath,$this->LLkey,$GLOBALS['TSFE']->renderCharset);
if($this->LLkey=='en')
{
$key = 'default';
}else
{
$key = $this->LLkey;
}
foreach($languageArray[$key] as $key=>$val)
{
$index = '###'.strtoupper($key).'###';
$markerArray[$index] = $val;
}
return $markerArray;
}
call above function it will return whole array of labels
Tuesday, October 9, 2012
Typoscript configuration for ke_userregister
plugin.tx_keuserregister.userDataPID = 7
plugin.tx_keuserregister.defaultUsergroup = 1
plugin.tx_keuserregister.defaultUsergroup = 1
Friday, September 28, 2012
How to post xml using cURL?
$xml_data = '<?xml version="1.0" encoding="UTF-8" ?>
<books>
<book>
<name>Ansi C</name>
</book>
</books>
';
$URL = "URL TO POST XML";
$ch = curl_init($URL);
//curl_setopt($ch, CURLOPT_MUTE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
header("Content-Type: text/xml");
echo $output;
curl_close($ch);
<books>
<book>
<name>Ansi C</name>
</book>
</books>
';
$URL = "URL TO POST XML";
$ch = curl_init($URL);
//curl_setopt($ch, CURLOPT_MUTE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
header("Content-Type: text/xml");
echo $output;
curl_close($ch);
Tuesday, September 25, 2012
how to get element of iframe inside parent frame?
window.opener.document.getElementById(ID_OF_IFRAME).contentDocument.getElementById(ID_OF_ELEMENT_INSIDE_IFRAME)
if "contentDocument" dont work then try with "contentWindow.document"
:)
if "contentDocument" dont work then try with "contentWindow.document"
:)
Tuesday, August 21, 2012
Get Typoscript setup variable in php
$GLOBALS["TSFE"]->tmpl->setup["plugin."]["tx_name_of_plugin."]["variable_name"]
Thursday, August 9, 2012
Encryption Key was empty!
Go to TYPO3 Install tool -> All Configurations
Enter anything in textfield of [encryptionKey] and save these settings.
An error will be removed.
Enter anything in textfield of [encryptionKey] and save these settings.
An error will be removed.
Saturday, August 4, 2012
Import gmail contacts api link
http://lookmywebpage.com/api/google/import-gmail-or-google-contacts-using-php-and-oauth-2-0/
Wednesday, August 1, 2012
Sort by parameters given in IN clause
Use MySQL's FIELD() function:
SELECT name, description, ...
FROM ...
WHERE id IN([ids, any order])
ORDER BY FIELD(id, [ids in order])
FIELD() will return the index of the first parameter that is equal to
the first parameter (other than the first parameter itself).
FIELD('a', 'a', 'b', 'c')
will return 1
FIELD('a', 'c', 'b', 'a')
will return 3
Tuesday, July 31, 2012
Friday, July 27, 2012
Invoke Mailer Engine issue
Add
$TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = 0;
in localconf.php , clear cache,
It's work for me :)
$TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = 0;
in localconf.php , clear cache,
It's work for me :)
Thursday, July 26, 2012
Configure direct mail in TYPO3
- Download and install TER extension direct mail and its dependencies extensions. Download using link http://typo3.org/extensions/repository/view/direct_mail
- Create one folder that contain plug in direct mail.
- Create templates for news letter under folder that contain direct mail plugins as newsletter templates.
- Add recipient list for news letter to send to, if you are assigning FE users for recipients then you have to check for an option Activate Newsletter.
- Or you can also create static or plain list.
Thursday, July 19, 2012
Create key base connection in putty
- Generate private public key pair from Putty Key Generator.
- After generating save private key by clicking "Save Private Key" button.
- Save the key with adding "key passphrase" for secure connection.
- Open putty and enter general details for connection like Host name or ip address and port, and path to generated private key ppk file in AUTH under SSH menu.
Open connection and you will be asked for passphrase , enter pass phrase you have given while saving .ppk file and connection will open.
Subscribe to:
Posts (Atom)