<?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>indexu.com &#187; Tutorial</title>
	<atom:link href="http://www.indexu.com/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.indexu.com</link>
	<description>developer blog</description>
	<lastBuildDate>Wed, 30 Jun 2010 05:06:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting up new mysql database with cpanel</title>
		<link>http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/</link>
		<comments>http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 22:06:24 +0000</pubDate>
		<dc:creator>dody</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.indexu.com/?p=46</guid>
		<description><![CDATA[Today I will show you a basic instruction how to setup a new mysql database for your indexu directory by using cpanel. 1) Open cpanel page, usually something like www.domain.com:2082, then enter your username and password that are provided by your hosting account. 2) Click on manage mysql database 3) Create a new mysql database [...]]]></description>
			<content:encoded><![CDATA[<p>Today I will show you a basic instruction how to setup a new mysql database for your indexu directory by using cpanel. </p>
<p>1) Open cpanel page, usually something like www.domain.com:2082, then enter your username and password that are provided by your hosting account.</p>
<p>2) Click on manage mysql database</p>
<p><img src="http://www.indexu.com/up/mysql1.png" alt="" /></p>
<p>3) Create a new mysql database</p>
<p><img src="http://www.indexu.com/up/mysql2.png" alt="" /></p>
<p>4) Create a new user name. Enter username and password.</p>
<p><img src="http://www.indexu.com/up/mysql3.png" alt="" /></p>
<p>5) Before you can use the database, you need to assign user to get access the database</p>
<p><img src="http://www.indexu.com/up/mysql4.png" alt="" /></p>
<p>6) Give the user all privilege</p>
<p><img src="http://www.indexu.com/up/mysql5.png" alt="" /></p>
<p>That&#8217;s it. Now you have mysql ready to use with indexu. Form this example it will be:<br />
MYSQL username: indexute_dody<br />
MYSQL password: poi0982<br />
MYSQL host: localhost<br />
MYSQL database name: indexute_indexudir</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/&amp;n=Setting+up+new+mysql+database+with+cpanel&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/&amp;title=Setting+up+new+mysql+database+with+cpanel" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/&amp;t=Setting+up+new+mysql+database+with+cpanel" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/&amp;title=Setting+up+new+mysql+database+with+cpanel" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-squidoo">
			<a href="http://www.squidoo.com/lensmaster/bookmark?http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/" rel="nofollow" class="external" title="Add to a lense on Squidoo">Add to a lense on Squidoo</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Setting+up+new+mysql+database+with+cpanel+-+http://b2l.me/3zhzm&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.indexu.com/setting-up-new-mysql-database-with-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show listing in two columns or more</title>
		<link>http://www.indexu.com/show-listing-in-two-columns-or-more/</link>
		<comments>http://www.indexu.com/show-listing-in-two-columns-or-more/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 02:15:38 +0000</pubDate>
		<dc:creator>dody</dc:creator>
				<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[listing]]></category>
		<category><![CDATA[multi columns]]></category>
		<category><![CDATA[two columns]]></category>

		<guid isPermaLink="false">http://www.indexu.com/?p=43</guid>
		<description><![CDATA[Bored to have listing in single column? I will show you how to make listing in multiple columns. Edit rows.html, clean the codes and replace with: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 &#60;%if $number % 2 eq 1%&#62; &#60;div class=&#34;row_nl&#34;&#62; &#60;%/if%&#62; &#160; &#60;div class=&#34;row_item myrow&#34;&#62; &#60;img [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.indexu.com/up/2colrow.png" alt="two columns rows.html" /></p>
<p>Bored to have listing in single column? I will show you how to make listing in multiple columns.</p>
<p>Edit <code>rows.html</code>, clean the codes and replace with:</p>

<div class="wp_codebox"><table><tr id="p433"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p43code3"><pre class="html4strict" style="font-family:monospace;">  <span style="color: #009900;">&lt;%if $number % <span style="color: #cc66cc;">2</span> eq <span style="color: #cc66cc;">1</span>%&gt;</span>
    <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;row_nl&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;%<span style="color: #66cc66;">/</span>if%&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;row_item myrow&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://open.thumbshots.org/image.aspx?url=&lt;%$url%&gt;</span></span>&quot; alt=&quot;<span style="color: #009900;">&lt;%$title%&gt;</span>&quot; style=&quot;border:1px solid #777;&quot;&gt;
    <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;%$url%&gt;</span></span>&quot; name=&quot;link_<span style="color: #009900;">&lt;%$link_id%&gt;</span>&quot;&gt;<span style="color: #009900;">&lt;%$title%&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span>
    <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;&lt;%$description%&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>
    <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;%$url%&gt;</span></span>&quot; name=&quot;link_<span style="color: #009900;">&lt;%$link_id%&gt;</span>&quot;&gt;<span style="color: #009900;">&lt;%$url%&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span> - <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;%$site_url%&gt;</span></span>/<span style="color: #009900;">&lt;%$detail_page_url%&gt;</span>&quot;&gt;<span style="color: #009900;">&lt;%t%&gt;</span>details<span style="color: #009900;">&lt;%<span style="color: #66cc66;">/</span>t%&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>
    <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>Google PR <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;%$site_url%&gt;</span></span>/googlepr.php?link_id=<span style="color: #009900;">&lt;%$link_id%&gt;</span>&quot; alt=&quot;&quot; /&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">p</span></a>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;%if $number % <span style="color: #cc66cc;">2</span> eq <span style="color: #cc66cc;">0</span>%&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span>
  <span style="color: #009900;">&lt;%<span style="color: #66cc66;">/</span>if%&gt;</span></pre></td></tr></table></div>

<p>Then add these 2 css classes to construct the layout.</p>

<div class="wp_codebox"><table><tr id="p434"><td class="code" id="p43code4"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.row_nl</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.row_item</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">285px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>



<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.indexu.com/show-listing-in-two-columns-or-more/&amp;n=Show+listing+in+two+columns+or+more&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.indexu.com/show-listing-in-two-columns-or-more/&amp;title=Show+listing+in+two+columns+or+more" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.indexu.com/show-listing-in-two-columns-or-more/&amp;t=Show+listing+in+two+columns+or+more" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.indexu.com/show-listing-in-two-columns-or-more/&amp;title=Show+listing+in+two+columns+or+more" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-squidoo">
			<a href="http://www.squidoo.com/lensmaster/bookmark?http://www.indexu.com/show-listing-in-two-columns-or-more/" rel="nofollow" class="external" title="Add to a lense on Squidoo">Add to a lense on Squidoo</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Show+listing+in+two+columns+or+more+-+http://b2l.me/3te9d&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.indexu.com/show-listing-in-two-columns-or-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show category listing as list of images</title>
		<link>http://www.indexu.com/show-category-listing-as-list-of-images/</link>
		<comments>http://www.indexu.com/show-category-listing-as-list-of-images/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 07:47:48 +0000</pubDate>
		<dc:creator>dody</dc:creator>
				<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[category listing]]></category>

		<guid isPermaLink="false">http://www.indexu.com/?p=38</guid>
		<description><![CDATA[In this tutorial I will show you how to create an alternative category listing in front page where the categories will be listed as a series of images. 1) Prepare the image files. Create a folder called &#8216;cat&#8216; in template folder. Then put the images files here. 2) Edit category image file for each categories [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.indexu.com/up/catlistingimage.png" alt="alternative category listing" /></p>
<p>In this tutorial I will show you how to create an alternative category listing in front page where the categories will be listed as a series of images. </p>
<p>1) Prepare the image files. Create a folder called &#8216;<code>cat</code>&#8216; in template folder. Then put the images files here.</p>
<p>2) Edit category image file for each categories with admin panel or phpmyadmin. Put the filename of image file you have prepared for each categories.</p>
<p><img src="http://www.indexu.com/up/catlistingimage2.png" alt="edit category image file" /></p>
<p>3) Edit <code>index.html</code>, add the following code where you want to put this category list.<br />
You can change <code>$item_per_row</code> value as you desire.</p>

<div class="wp_codebox"><table><tr id="p387"><td class="code" id="p38code7"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;%</span>php<span style="color: #000000; font-weight: bold;">%&gt;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$dbConn</span><span style="color: #339933;">,</span> <span style="color: #000088;">$indexu</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$item_per_row</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$img_path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$indexu</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'site_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/themes/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$indexu</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active_theme'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/cat'</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select name, image
            from idx_category
            where parent_id = '0'&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dbConn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Execute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">RecordCount</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">FetchRow</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$item_per_row</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;div class='cat_nl'&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> SEOReplace<span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;div class='cat_item'&gt;&lt;a href='<span style="color: #006699; font-weight: bold;">$url</span>'&gt;
           &lt;img src='<span style="color: #006699; font-weight: bold;">$img_path</span>/<span style="color: #006699; font-weight: bold;">{$row['image']}</span>' title='<span style="color: #006699; font-weight: bold;">{$row['name']}</span>' alt='<span style="color: #006699; font-weight: bold;">{$row['name']}</span>' /&gt;&lt;/a&gt;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$item_per_row</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$i</span><span style="color: #339933;">==</span><span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #339933;">/</span>php<span style="color: #000000; font-weight: bold;">%&gt;</span></pre></td></tr></table></div>

<p>4) Add the following css classes into css file, usually <code>style.css</code></p>

<div class="wp_codebox"><table><tr id="p388"><td class="code" id="p38code8"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.cat_nl</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.cat_item</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>



<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.indexu.com/show-category-listing-as-list-of-images/&amp;n=Show+category+listing+as+list+of+images&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.indexu.com/show-category-listing-as-list-of-images/&amp;title=Show+category+listing+as+list+of+images" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.indexu.com/show-category-listing-as-list-of-images/&amp;t=Show+category+listing+as+list+of+images" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.indexu.com/show-category-listing-as-list-of-images/&amp;title=Show+category+listing+as+list+of+images" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-squidoo">
			<a href="http://www.squidoo.com/lensmaster/bookmark?http://www.indexu.com/show-category-listing-as-list-of-images/" rel="nofollow" class="external" title="Add to a lense on Squidoo">Add to a lense on Squidoo</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Show+category+listing+as+list+of+images+-+http://b2l.me/3mqnf&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.indexu.com/show-category-listing-as-list-of-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding dynamic gmap with navigation and zooming</title>
		<link>http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/</link>
		<comments>http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 00:34:12 +0000</pubDate>
		<dc:creator>dody</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[google map]]></category>

		<guid isPermaLink="false">http://www.indexu.com/?p=26</guid>
		<description><![CDATA[As many of you request how to replace the static gmap image with dynamic gmap which allow navigation and zooming, I made some test how to do this for the easiest way. Ok. This is the easiest way. We only need to change the template files. Actually only 2 files. Edit header.html, usually we use [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.indexu.com/up/gmap1.png" alt="google map with navigation" title="google map with navigation" /></p>
<p>As many of you request how to replace the static gmap image with dynamic gmap which allow navigation and zooming, I made some test how to do this for the easiest way.</p>
<p>Ok. This is the easiest way. We only need to change the template files. Actually only 2 files.</p>
<p>Edit <code>header.html</code>, usually we use</p>

<div class="wp_codebox"><table><tr id="p2613"><td class="code" id="p26code13"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span></pre></td></tr></table></div>

<p> but now we need to add <code>onload</code> call to js to load gmap only when detail page is accessed.</p>

<div class="wp_codebox"><table><tr id="p2614"><td class="code" id="p26code14"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;%</span>php<span style="color: #000000; font-weight: bold;">%&gt;</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$page_identifier</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$page_identifier</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'detail.php'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'&lt;body onload=&quot;initialize()&quot; onunload=&quot;GUnload()&quot;&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;body&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #339933;">/</span>php<span style="color: #000000; font-weight: bold;">%&gt;</span></pre></td></tr></table></div>

<p>Edit <code>detail_link.html</code>, add the <code>div</code> container to show the map, it must have id <code>gmapnav_canvas</code>.</p>

<div class="wp_codebox"><table><tr id="p2615"><td class="code" id="p26code15"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span>Location Map<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span>
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;gmapnav_canvas&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width: 640px; height: 400px;text-align:center;margin: 20px;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></pre></td></tr></table></div>

<p>Next, the last step is to construct the js code for google map. Edit <code>detail_link.html</code>, you can put the code at the of this file.</p>

<div class="wp_codebox"><table><tr id="p2616"><td class="code" id="p26code16"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;%</span>php<span style="color: #000000; font-weight: bold;">%&gt;</span>
&nbsp;
  <span style="color: #000088;">$api_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$dbConn</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select * from idx_link where link_id = '<span style="color: #006699; font-weight: bold;">{$_REQUEST['linkid']}</span>' limit 1&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dbConn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Execute</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$address</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Fields</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;address&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$city</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Fields</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;city&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$zip</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Fields</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;zip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$state</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Fields</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;state&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$country</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Fields</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;country&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$loc</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/urlencode"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$address</span>, <span style="color: #006699; font-weight: bold;">$city</span>, <span style="color: #006699; font-weight: bold;">$state</span>, <span style="color: #006699; font-weight: bold;">$zip</span>, <span style="color: #006699; font-weight: bold;">$country</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$api_req</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://maps.google.com/maps/geo?q='</span><span style="color: #339933;">.</span><span style="color: #000088;">$loc</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;key='</span><span style="color: #339933;">.</span><span style="color: #000088;">$api_key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;sensor=false&amp;output=csv'</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$api_result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$api_req</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #000088;">$api_result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'200'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$latlng</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">','</span><span style="color: #339933;">.</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$gmap_js</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;
    &lt;script src=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=<span style="color: #006699; font-weight: bold;">{$api_key}</span><span style="color: #000099; font-weight: bold;">\&quot;</span> type=<span style="color: #000099; font-weight: bold;">\&quot;</span>text/javascript<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;/script&gt;
    &lt;script type=<span style="color: #000099; font-weight: bold;">\&quot;</span>text/javascript<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;
    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById(<span style="color: #000099; font-weight: bold;">\&quot;</span>gmapnav_canvas<span style="color: #000099; font-weight: bold;">\&quot;</span>));
        map.setCenter(new GLatLng(<span style="color: #006699; font-weight: bold;">{$latlng}</span>), 10);
&nbsp;
        var latlng = new GLatLng(<span style="color: #006699; font-weight: bold;">{$latlng}</span>);
        map.addOverlay(new GMarker(latlng));
&nbsp;
        map.addControl(new GSmallMapControl());
      }
    }
   &lt;/script&gt;
    &quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">print</span> <span style="color: #000088;">$gmap_js</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #339933;">/</span>php<span style="color: #000000; font-weight: bold;">%&gt;</span></pre></td></tr></table></div>



<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/&amp;n=Adding+dynamic+gmap+with+navigation+and+zooming&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/&amp;title=Adding+dynamic+gmap+with+navigation+and+zooming" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/&amp;t=Adding+dynamic+gmap+with+navigation+and+zooming" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/&amp;title=Adding+dynamic+gmap+with+navigation+and+zooming" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-squidoo">
			<a href="http://www.squidoo.com/lensmaster/bookmark?http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/" rel="nofollow" class="external" title="Add to a lense on Squidoo">Add to a lense on Squidoo</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Adding+dynamic+gmap+with+navigation+and+zooming+-+http://b2l.me/3jf2y&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.indexu.com/adding-dynamic-gmap-with-navigation-and-zooming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

