<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Minimizr.com &#187; Google</title>
	<atom:link href="http://minimizr.com/blog/category/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://minimizr.com</link>
	<description>More With Less</description>
	<lastBuildDate>Sun, 28 Oct 2007 13:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=6031</generator>
		<item>
		<title>Minimal How to Use Google Maps API With PHP</title>
		<link>http://minimizr.com/blog/2006/10/minimal-how-to-use-google-maps-api-with-php/</link>
		<comments>http://minimizr.com/blog/2006/10/minimal-how-to-use-google-maps-api-with-php/#comments</comments>
		<pubDate>Sat, 21 Oct 2006 13:39:35 +0000</pubDate>
		<dc:creator>kristian</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.minimizr.com/blog/2006/10/minimal-how-to-use-google-maps-api-with-php/</guid>
		<description><![CDATA[The goal of this how to is to easily add multiple markes into the map on your own site using Google Maps API and PHP. Google Maps API key If you don&#8217;t already have, sign up for the Google Account. Sign up for the Google Maps API key. Read at least the higlights from the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.google.com/apis/maps/"><img id="image35" src="http://www.minimizr.com/wp-content/uploads/minimizr.com/2006/10/post-google-maps-php.gif" alt="Google Maps" style="float:right;margin-left:10px;"/></a><span class="summary"><strong>The goal of this how to is to easily add multiple markes into the map on your own site using Google Maps API and PHP.</strong></span></p>
<h4>Google Maps API key</h4>
<ol>
<li>If you don&#8217;t already have, sign up for the <a href="http://www.google.com/accounts/">Google Account</a>.</li>
<li>Sign up for the <a href="http://www.google.com/apis/maps/signup.html">Google Maps API key.</a> Read at least the higlights from the Google Maps API terms. Sign up for your site, forexample <em>http://www.mysite.com/</em></li>
</ol>
<p>After sign up you&#8217;ll get your key and an example html code. If you lost your key anytime, you can sign up again for the same site and use a new key. You can also sign up for multiple sites keys if needed. You&#8217;ll get different key for each site.</p>
<h4>JavaScript</h4>
<p>To add multiple markers on your map we&#8217;ll use some basic PHP code. Google&#8217;s example code is a good starting point for this:</p>
<pre lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
  Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html;
    charset=utf-8"/>

    <script src="http://maps.google.com/maps?
      file=api&amp;v=2&amp;key=ABCDEFGH..."
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(
        document.getElementById("map"));
        map.setCenter(
        new GLatLng(37.4419, -122.1419), 13);
      }
    }
    //]]&gt;
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
<div id="map"
    style="width: 500px; height: 300px"></div>

  </body>
</html>
</pre>
<p>You have your API key on the html head and JavaScript to load on page load and div element to show the map. With map.setCenter(new GLatLng(37.4419, -122.1419), 13) you define the map&#8217;s center point and the zoom level. Here is an <a href="http://www.minimizr.com/example/2006/10/minimal-how-to-google-maps-api-with-php-1.php">example</a>.</p>
<p>To have some controls in the map, add this line into JavaScript load funtion:</p>
<pre>map.addControl(new GSmallMapControl());</pre>
<p>Add this JavaScript function to make markers:</p>
<pre lang="javascript">
function createMarker(point, text, title) {
  var marker = new GMarker(point,{title:title});
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(text);
  });
  return marker;
}
</pre>
<p>Add marker with this code:</p>
<pre lang="javascript">
var marker = createMarker(
new GLatLng(37.4419, -122.1419),
'Marker text', 'Example Title text');
map.addOverlay(marker);
</pre>
<p>Note that you can add in the markers any html code like links and images for example. So, the code looks now like this:</p>
<pre lang="html4strict"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
  Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html;
    charset=utf-8"/>

    <script src="http://maps.google.com/maps?
      file=api&amp;v=2&amp;key=ABCDEFGH..."
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(
        document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.setCenter(
        new GLatLng(37.4419, -122.1419), 13);
        function createMarker(point, text, title) {
          var marker =
          new GMarker(point,{title:title});
          GEvent.addListener(
          marker, "click", function() {
            marker.openInfoWindowHtml(text);
          });
          return marker;
        }
        var marker = createMarker(
        new GLatLng(37.4419, -122.1419),
        'Marker text', 'Example Title text');
        map.addOverlay(marker);
      }
    }
    //]]&gt;
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
<div id="map"
    style="width: 500px; height: 300px"></div>

  </body>
</html>
</pre>
<p>Here is an <a href="http://www.minimizr.com/example/2006/10/minimal-how-to-google-maps-api-with-php-2.php">example</a>.</p>
<h4>PHP</h4>
<p>In order to add multiple markes, we&#8217;ll use some PHP to iterate over some marker points. Let&#8217;s use an array in this example, but you could get the marker points for example from database or xml file. Put the following lines around marker adding lines:</p>
<pre lang="php">
<?php
$points = Array(1 => "37.4389, -122.1389",
2 => "37.4419, -122.1419",
3 => "37.4449, -122.1449");
foreach ($points as $key => $point) {
?>
var marker = createMarker(
new GLatLng(<?php echo $point ?>),
'Marker text <?php echo $key ?>',
'Example Title text <?php echo $key ?>');
map.addOverlay(marker);
<?php } ?>
</pre>
<p>And here is the final code:</p>
<pre lang="html4strict">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
  Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html;
    charset=utf-8"/>

    <script src="http://maps.google.com/maps?
      file=api&amp;v=2&amp;key=ABCDEFGH..."
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(
        document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.setCenter(
        new GLatLng(37.4419, -122.1419), 13);
        function createMarker(point, text, title) {
          var marker =
          new GMarker(point,{title:title});
          GEvent.addListener(
          marker, "click", function() {
            marker.openInfoWindowHtml(text);
          });
          return marker;
        }
        <?php
        $points = Array(
        1 => "37.4389, -122.1389",
        2 => "37.4419, -122.1419",
        3 => "37.4449, -122.1449");
        foreach ($points as $key => $point) {
        ?>
        var marker = createMarker(
        new GLatLng(<?php echo $point ?>),
        'Marker text <?php echo $key ?>',
        'Example Title text <?php echo $key ?>');
        map.addOverlay(marker);
        <?php } ?>
      }
    }
    //]]&gt;
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
<div id="map"
    style="width: 500px; height: 300px"></div>

  </body>
</html>
</pre>
<p>And here is the final <a href="http://www.minimizr.com/example/2006/10/minimal-how-to-google-maps-api-with-php-3.php">example</a>.</p>
<p>If you have let&#8217;s say hundereds or thousands and more markers in your map, you might want to give a try to <a href="http://www.acme.com/javascript/#Clusterer">Clusterer</a>. It is an excellent and easy to use JavaScript library by Jef Poskanzer.</p>
<p>This how to showed only very basic usage of Google Maps API. To learn more Google Maps API has a good <a href="http://www.google.com/apis/maps/documentation/">documentation</a> and <a href="http://www.econym.demon.co.uk/">Mike</a> has many excellent <a href="http://www.econym.demon.co.uk/googlemaps/index.htm">examples</a> of the basics and more andvanced stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://minimizr.com/blog/2006/10/minimal-how-to-use-google-maps-api-with-php/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>From Del.icio.us to Google Bookmarks</title>
		<link>http://minimizr.com/blog/2006/10/from-delicious-to-google-bookmarks/</link>
		<comments>http://minimizr.com/blog/2006/10/from-delicious-to-google-bookmarks/#comments</comments>
		<pubDate>Fri, 20 Oct 2006 19:26:04 +0000</pubDate>
		<dc:creator>kristian</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.minimizr.com/blog/2006/10/from-delicious-to-google-bookmarks/</guid>
		<description><![CDATA[If you are for Google Bookamarks, you might be interested in about bookmarks importer from Del.icio.us to Google Google Bookmarks needs still quite a lot improvements to become a competitior for other bookmarking services, but still it has it&#8217;s advantages if you use also other Google&#8217;s services. Google Bookmarks are also private. Persistent.info has a [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img id="image34" src="http://www.minimizr.com/wp-content/uploads/minimizr.com/2006/10/post-google-bookmarks.gif" alt="Google Bookmarks" style="float:right;margin-left:10px;"/><span class="summary"><strong>If you are for Google Bookamarks, you might be interested in about bookmarks importer from Del.icio.us to Google</strong></span></p>
<p>Google Bookmarks needs still quite a lot improvements to become a competitior for other bookmarking services, but still it has it&#8217;s advantages if you use also other Google&#8217;s services. Google Bookmarks are also private. Persistent.info has a script for <a href="http://persistent.info/archives/2006/10/16/delicious-google-bookmarks">importing Del.icio.us bookmarks to Google</a>. You can use the <a href="http://persistent.info/delicious2google/">script</a> on their website or copy the script and run your own copy.</p>
]]></content:encoded>
			<wfw:commentRss>http://minimizr.com/blog/2006/10/from-delicious-to-google-bookmarks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
