<?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>0t@k-B@L! &#187; programming</title>
	<atom:link href="http://www.otakbali.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otakbali.com</link>
	<description>think about web programming</description>
	<lastBuildDate>Mon, 02 Aug 2010 03:56:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Surfing Contest Game</title>
		<link>http://www.otakbali.com/surfing-contest-game.html</link>
		<comments>http://www.otakbali.com/surfing-contest-game.html#comments</comments>
		<pubDate>Mon, 02 Aug 2010 03:56:36 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[announcement]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.otakbali.com/?p=117</guid>
		<description><![CDATA[Hi all,, I&#8217;ve been creating a simple game called Surfing Contest Game. It is a add on for surfing site, Traffic exchange site, like shinelight-traffic.com and rainbow-traffic.com which require the user to surf the sites on the site. The script built in PHP, mySQL, javascript, and a litle human language.. yeah of course. Now, the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,,</p>
<p>I&#8217;ve been creating a simple game called Surfing Contest Game. It is a add on for surfing site, Traffic exchange site, like shinelight-traffic.com and rainbow-traffic.com which require the user to surf the sites on the site.</p>
<p>The script built in PHP, mySQL, javascript, and a litle human language.. yeah of course. <img src='http://www.otakbali.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Now, the function of the script actually to create a contest or game where the user can invite, or in another word, to challenge the other user to play. The goal is to surf and click as much as they can until the end of the day (when the server changing it&#8217;s date). And the user with most click started when the challenge begin until the server changing it&#8217;s time is the winner. Well, the prize, the challenger can choose the prize before he can send the invitation to the target user. Of course the prize will be not available for several user, because the prize displayed will be the prize for it&#8217;s user level only. For example, the user with free member only can see the prize for free member only, they can&#8217;t see the prizes for gold, diamond, or other special level.</p>
<p>For the live example, you may go to the surfing area of the <a title="Live ecample" href="http://shinelight-traffic.com/surfing.php" target="_blank">shinelight-traffic.com/surfing.php</a>.  If you don&#8217;t have any account yet, please register, it&#8217;s free.</p>
<p>Well, they pay me for the script. If you interested with the script, you can contact me for a deal ^_^.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/surfing-contest-game.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>exact position in a div tag</title>
		<link>http://www.otakbali.com/exact-position-in-a-div-tag.html</link>
		<comments>http://www.otakbali.com/exact-position-in-a-div-tag.html#comments</comments>
		<pubDate>Sun, 16 May 2010 10:43:39 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[exact]]></category>
		<category><![CDATA[menaruh]]></category>
		<category><![CDATA[posisi]]></category>
		<category><![CDATA[position]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[tepat]]></category>

		<guid isPermaLink="false">http://www.otakbali.com/exact-position-in-a-div-tag/</guid>
		<description><![CDATA[Maybe you ever wonder how to put a content like text or picture with exact position in a html page. Now i will explain it shortly. I don&#8217;t understand css too much, so i will explain how tu put content in an exact position by modifying inline div tag. Here is an example: &#60;div style=&#8221;top: [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe you ever wonder how to put a content like text or picture with exact position in a html page. Now i will explain it shortly.</p>
<p>I don&#8217;t understand css too much, so i will explain how tu put content in an exact position by modifying inline div tag.</p>
<p>Here is an example:</p>
<blockquote><p>&lt;div style=&#8221;top: 50px; left: 60px;&#8221;&gt;</p>
<p>&lt;!&#8211; content goes here &#8211;&gt;</p>
<p>&lt;/div&gt;</p></blockquote>
<p>It will put your  content 50pixels from top of the page, and 60pixels from left of the html page.</p>
<p>well, thats it.. <img src='http://www.otakbali.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/exact-position-in-a-div-tag.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lost Your Data…?? Get Yourself Backup Software!!</title>
		<link>http://www.otakbali.com/lost-your-data-get-yourself-backup-software.html</link>
		<comments>http://www.otakbali.com/lost-your-data-get-yourself-backup-software.html#comments</comments>
		<pubDate>Wed, 28 Apr 2010 15:22:03 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.otakbali.com/?p=91</guid>
		<description><![CDATA[‘Internet backup&#8217;, ‘remote backup&#8217;, or ‘offsite backup&#8217;, are some other names for online server backup software. Its functioning includes the transmission of our data to a server of offsite backup, harmlessly with the help of the typical internet connection. All our important financial documents and our photographs that capture some of our unforgettable memories get [...]]]></description>
			<content:encoded><![CDATA[<p>‘Internet backup&#8217;, ‘remote backup&#8217;, or ‘offsite backup&#8217;, are some  other names for online server backup software. Its functioning includes  the transmission of our data to a server of offsite backup, harmlessly  with the help of the typical internet connection. All our important  financial documents and our photographs that capture some of our  unforgettable memories get completely destroyed when the computer  crashes. This might even happen if a small cup of tea is knocked up on  our computer. It might cost us a whole lot of bucks to get back the data  which is lost. It might even be impossible though. Thus, software that  can effortlessly get back the lost data needs to be installed.</p>
<p>To  render the enigma of the loss of data, there are innumerable ways that  we can use. Earlier, big server systems were utilized to recover the  data, but now it is done by using tiny-mini USB keys. The process of  recovery will have to be undertaken by us, is the main perplexity that  we get by when we install a cheap backup system. This arouses anxiety in  us regarding the storage memory in the backup. The whole phenomenon of  our computer being backed up is a bleak one and we may not be able to  endure all this without having enough time, which we usually do not have  while working.<br />
Having a protected backup system followed by an automated  replica of all our important and pretentious data seized and accumulated  in a safe spot is one of the best ways to back up our computer. Ample  of online software backup would give us diminutive software that has to  be installed in our computer; this is why this has been made possible  with the online server backup. To delimit the data that needs backup and  when, we may use the settings that this program contains. It will  involuntarily be connected to the protected information storage space  and will dispatch a replica of our data there when the time specified is  reached.</p>
<p>There are some programs present that enable us in  taking real time software that backs up the files as soon as they are  saved on the hard disk. Such backup software is worth installing. This  system has proved to be one of the most protected server backup, as it  is perfect for those who have the tendency of forgetting that their  computer needs to be regularly backed up. Once this has been done the  data is safely stored in the storage location for as much time as we  desire it to be. This software can be easily bagged from any of the  online websites.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/lost-your-data-get-yourself-backup-software.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Photo Gallery using Flickr API</title>
		<link>http://www.otakbali.com/how-to-create-photo-gallery-using-flickr-api.html</link>
		<comments>http://www.otakbali.com/how-to-create-photo-gallery-using-flickr-api.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 15:50:43 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=80</guid>
		<description><![CDATA[Flickr is, without doubt, the biggest and best photography website on the internet. There are lots of widgets, badges and plugins which allow you to display your latest Flickr photos on your website, but we’ll take it a step further by tapping straight into Flickr and integrating your photostream into your website, giving you a [...]]]></description>
			<content:encoded><![CDATA[<p>Flickr is, without doubt, the biggest and best photography website on the internet. There are lots of widgets, badges and plugins which allow you to display your latest Flickr photos on your website, but we’ll take it a step further by tapping straight into Flickr and integrating your photostream into your website, giving you a photo gallery that is a breeze to update.</p>
<p><span id="more-7708"> </span></p>
<div class="tutorial_image"><a href="http://nettuts.s3.amazonaws.com/491_flickr/Flickr_API-sample%20files.zip"><img src="http://net.tutsplus.com/wp-content/themes/nettuts/site_images/button_src_nm.jpg" alt="" /></a></p>
<p><a href="http://nettuts-fd.iampaulburgess.co.uk/"><img src="http://net.tutsplus.com/wp-content/themes/nettuts/site_images/button_demo_nm.jpg" alt="" /></a></p>
</div>
<p>We’ll be creating <a title="this photo gallery" href="http://nettuts-fd.iampaulburgess.co.uk">this photo gallery</a> using the Flickr API and <a title="phpFlickr" href="http://phpflickr.com/">phpFlickr</a> . If the letters ‘A,P &amp; I’ are enough to strike fear into your  heart, don’t worry, we will take it slow and give full code examples  that you can copy.</p>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/finalproject.jpg" alt="Final Project" /></div>
<p>Flickr have also recently launched <a href="http://www.flickr.com/services/">The App Garden</a>, which is a showcase of tools, toys and sites which use the Flickr API to offer something useful or fun. Once you get to grips with using the API, you can let your imagination conjure up a new way to use it and submit your app.<span id="more-80"></span></p>
<p>For this tutorial I am presuming that you already have a Flickr account, and access to a server that runs PHP and PEAR.</p>
<h3>The Outline</h3>
<ul>
<li> Get a Flickr API key</li>
<li> Download the phpFlickr files</li>
<li> Build a gallery page to display our thumbnails (with pagination)</li>
<li> Make a photo page to show our photos (with previous and next navigation)</li>
</ul>
<h3>Step 1 – Get a Flickr API key</h3>
<p>Your API key is your own unique series of numbers and letters which grant you access to Flickr’s services. Go here:  http://www.flickr.com/services/apps/create/apply/</p>
<p>Here you must decide if you are going to use Flickr for commercial or non-commercial purposes. Flickr provide good explanations as to which  you should choose, chances are you’ll need a non-commercial API key,  which is what I am choosing for this demo.</p>
<p>Follow the steps and fill in all your details.</p>
<p>You should then be presented with your unique key which will appear as a series of random numbers and letters like so:</p>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/api-key.png" alt="API key example" width="546" height="222" /></div>
<p>You’ll also see a number called ‘Secret;’ ignore that for now. For this exercise  we only need the key; make a note of it as we’ll need it soon.</p>
<p>If you use the API to build a cool tool or site later on, you might want to submit and feature whatever you build in the Flickr App Garden. You can click on ‘Edit app details’ to fill in the info.</p>
<blockquote><p>Pay particular attention to the tips and advice  given in the <a href="http://www.flickr.com/services/api/tos/">API Terms of Use</a> and the <a href="http://www.flickr.com/guidelines.gne">Community Guidelines</a>, if you abuse it, you’ll lose it.</p></blockquote>
<p>Now on to the exciting stuff…</p>
<h3>Step 2 – Download phpFlickr</h3>
<p><a id="kguo" title="phpFlickr" href="http://phpflickr.com/">phpFlickr</a> is a project by <a href="http://www.dancoulter.com/">Dan Coulter</a>. It is a class written in PHP which acts as a wrapper for Flickr’s API. The files process the data provided by Flickr and return arrays in PHP, which we use to display our photos</p>
<p>We need to download the files that we will later include in our webpage, and will do all the complicated work for us. Visit <a id="y5sq" title="phpflickr.com" href="http://phpflickr.com/">phpflickr.com</a> or skip straight to <a title="The download page at Google Code" href="http://code.google.com/p/phpflickr/downloads/list">the download page at Google Code.</a> In this demo, we’ll be using the zip file:   	phpFlickr-2.3.1 (zip)</p>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/download-link.png" alt="Download link" width="444" height="265" /></div>
<p>Download and unzip it. For this tutorial, we only need the PEAR folder and the phpFlickr.php file. Upload the files to your web directory</p>
<h3>Step 3 – Basic Setup and Simple Configuration</h3>
<p>Now  we have all we need to connect with Flickr and retrieve our photos. We’ll make two pages: one to show our thumbnails and one to show the photo. All of the code will be available as complete pages at the end of the tutorial.</p>
<p>These code examples are all working on the basis that your files are on the root of your server – or all in the same folder. Before anything else, we need to create a cache folder in order for phpFlickr  to work properly. Create a folder called ‘cache’ in your web directory  and give it writable permissions (CHMOD 777).</p>
<p>Now we’ll build a page that displays our thumbnails and has some simple paging. In the example gallery, this is index.php – and <a id="mhb6" title="looks like this" href="http://nettuts-fd.iampaulburgess.co.uk/">looks like this</a>.</p>
<p>Before we go any further, we need to set two main variables in the config.php file.</p>
<p>Open config.php. You’ll see it’s just asking for two things: your API key and your Flickr username.</p>
<p>First, enter your API key – the long random set of numbers and letters you were given earlier on by Flickr. Keep your info inside the quote marks.</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('About',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="comment">// insert your API key</span><span> </span></span></li>
<li><span><span class="vars">$key</span><span>=</span><span class="string">&#8220;ENTER YOUR FLICKR API KEY HERE&#8221;</span><span>; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">// insert your API key
$key="ENTER YOUR FLICKR API KEY HERE";</pre>
<p>Now for your Flickr username; this is  not your Yahoo sign-in username or your Flickr screename – but the  username you use for Flickr itself. To double check, sign in to Flickr and look at the top of the page where it says ‘Signed in as…’ – that is your username. So let’s declare our username as a variable:</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="comment">// enter your Flickr username</span><span> </span></span></li>
<li><span><span class="vars">$username</span><span>=</span><span class="string">&#8220;YOUR FLICKR USERNAME HERE&#8221;</span><span>; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">// enter your Flickr username
$username="YOUR FLICKR USERNAME HERE";</pre>
<p>Save the changes to config.php and upload – you shouldn’t need that file again.</p>
<h3>Step 4 – Building the Thumbnails Page</h3>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/finalproject.jpg" alt="Final Project" /></div>
<p>On to the page itself. Here’s a breakdown of what we are doing at the top of the page, which cues up everything ready for the action:</p>
<p>We are going to include some Previous and Next links with a small  bit of code further down the page. The thumbnails we are going to show  depend on what page we are on, so we run a simple if  statement which will grab our page number. If there’s a ‘fpage’ query in  the url, use that. If not, we are on page one.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span> <span class="comment">// get page number from the url - if there isn&#8217;t one - we&#8217;re on page 1</span><span> </span></span></li>
<li class="alt"><span> <span class="vars">$page</span><span> = isset(</span><span class="vars">$_GET</span><span>[</span><span class="string">'page'</span><span>]) ? </span><span class="vars">$_GET</span><span>[</span><span class="string">'page'</span><span>] : 1; </span></span></li>
<li><span> </span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;?php
  // get page number from the url - if there isn't one - we're on page 1
  $page = isset($_GET['page']) ? $_GET['page'] : 1;</pre>
<p>Next we include the core phpFlickr file that has everything we need in it communicate with Flickr.</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="comment">// inclue the core file</span><span> </span></span></li>
<li><span> <span class="keyword">require_once</span><span>(</span><span class="string">&#8216;phpFlickr.php&#8217;</span><span>); </span></span></li>
<li class="alt"><span> </span></li>
</ol>
</div>
<pre class="php" style="display: none;">// inclue the core file
  require_once('phpFlickr.php');</pre>
<p>Now we fire up a new class from the phpFlickr file using our API key that we got earlier.</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="comment">// Fire up the main phpFlickr class</span><span> </span></span></li>
<li><span><span class="vars">$f</span><span> = </span><span class="keyword">new</span><span> phpFlickr(</span><span class="vars">$key</span><span>); </span></span></li>
<li class="alt"><span> </span></li>
</ol>
</div>
<pre class="php" style="display: none;">// Fire up the main phpFlickr class
$f = new phpFlickr($key);</pre>
<p>phpFlickr uses caching to speed the  process up. There are options of using a database technique but for  this tutorial we will use the simpler cache folder option. We need  a folder called ‘cache’ that is writable, meaning that the system has  access to it and can alter its contents. To do this set the folders’  permissions to 777 via your FTP program. Then we add this line to enable it:</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="vars">$f</span><span>-&gt;enableCache(</span><span class="string">&#8220;fs&#8221;</span><span>, </span><span class="string">&#8220;cache&#8221;</span><span>); </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">$f-&gt;enableCache("fs", "cache");</pre>
<p>We call the people_findByUsername method which returns an array:</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="vars">$result</span><span> = </span><span class="vars">$f</span><span>-&gt;people_findByUsername(</span><span class="vars">$username</span><span>); </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">$result = $f-&gt;people_findByUsername($username);</pre>
<p>From that array, we also need your unique user id (your Flickr id that look  like this: 11221312@N00, declared here as $nsid) which we get like so:</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="comment">// grab our unique user id from the $result array</span><span> </span></span></li>
<li><span> <span class="vars">$nsid</span><span> = </span><span class="vars">$result</span><span>[</span><span class="string">"id"</span><span>]; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">// grab our unique user id from the $result array
  $nsid = $result["id"];</pre>
<p>Next, we call the people_getPublicPhotos method, which again returns an array that we will call $photos. In  this line, we are also passing through our id which we got in the line  above ($nsid). NULL refers to the ‘extras’ option which we’re not  concerned with right now. We are also stating the number of thumbnails  we want to display (21), and are passing through the page to  start on ($page) which relates back to the $page variable from the top of  the page:</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span class="vars">$photos</span><span> = </span><span class="vars">$f</span><span>-&gt;people_getPublicPhotos(</span><span class="vars">$nsid</span><span>, NULL, NULL, 21, </span><span class="vars">$page</span><span>); </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;"> $photos = $f-&gt;people_getPublicPhotos($nsid, NULL, NULL, 21, $page);</pre>
<p>The last bit we need to set the page up is a little bit of info we need for the paging to work. We  access the $photos array we created above, and pull out the the total  number of pages, plus the total amount of photos in our photostream:</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools"><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="#"></a></div>
</div>
<ol class="dp-c">
<li class="alt"><span><span class="vars">$pages</span><span> = </span><span class="vars">$photos</span><span>[photos][pages]; </span><span class="comment">// returns total number of pages</span><span> </span></span></li>
<li><span> <span class="vars">$total</span><span> = </span><span class="vars">$photos</span><span>[photos][total]; </span><span class="comment">// returns how many photos there are in total</span><span> </span></span></li>
<li class="alt"><span> ?&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">$pages = $photos[photos][pages]; // returns total number of pages
  $total = $photos[photos][total]; // returns how many photos there are in total
  ?&gt;</pre>
<p>Notice we’re closing the php section off here with the ?&gt; Now we have all we need to get the first 21 thumbnails from our Flickr photostream and display them. We’ll carry on with the page now, adding some html, using PHP to show the images, and include some simple paging links. So let’s start by writing some basic html.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span> &lt;!DOCTYPE html  PUBLIC </span><span class="string">&#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</span><span> </span></span></li>
<li><span><span class="string">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</span><span>&gt; </span></span></li>
<li class="alt"><span>&lt;html&gt; </span></li>
<li><span>&lt;head&gt; </span></li>
<li class="alt"><span>&lt;meta http-equiv=<span class="string">&#8220;Content-Type&#8221;</span><span> content=</span><span class="string">&#8220;text/html; charset=iso-8859-1&#8243;</span><span> /&gt; </span></span></li>
<li><span>&lt;title&gt;Nettuts Flickr Gallery Demo&lt;/title&gt; </span></li>
<li class="alt"><span>&lt;/head&gt; </span></li>
<li><span> </span></li>
<li class="alt"><span>&lt;body&gt; </span></li>
<li><span> </span></li>
<li class="alt"><span>&lt;h1&gt;My photo gallery&lt;/h1&gt; </span></li>
<li><span>&lt;div id=<span class="string">&#8220;thumbs&#8221;</span><span>&gt; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;"> &lt;!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Nettuts Flickr Gallery Demo&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;h1&gt;My photo gallery&lt;/h1&gt;

&lt;div id="thumbs"&gt;</pre>
<p>Nothing out of the ordinary here; just setting up the html and starting an area for the thumbnails. The next step is to fill our div called ‘thumbs’ with our thumbnails like so:</p>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/thumbnails-example.jpg" alt="Thumbnails example" width="601" height="224" /></div>
<p>Note we’re opening php again with &lt;?php:</p>
<p>We’ll  use a foreach loop to run through the $photos array and to get to the  photo element ($photo), which holds the info we need for the thumbnails.</p>
<p>See the comments in the code for an explanation of what’s going on:</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span><span class="comment">// loop through each photo</span><span> </span></span></li>
<li class="alt"><span> <span class="keyword">foreach</span><span> (</span><span class="vars">$photos</span><span>[</span><span class="string">'photos'</span><span>][</span><span class="string">'photo'</span><span>] </span><span class="keyword">as</span><span> </span><span class="vars">$photo</span><span>) { </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// print out a link to the photo page, attaching the id of the photo</span><span> </span></span></li>
<li><span> <span class="func">echo</span><span> </span><span class="string">&#8220;&lt;a href=\&#8221;photo.php?id=$photo[id]\&#8221; title=\&#8221;View $photo[title]\&#8221;&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// This next line uses buildPhotoURL to construct the location of our image, and we want the &#8217;Square&#8217; size</span><span> </span></span></li>
<li class="alt"><span><span class="comment">// It also gives the image an alt attribute of the photo&#8217;s title</span><span> </span></span></li>
<li><span> <span class="func">echo</span><span> </span><span class="string">&#8220;&lt;img src=\&#8221;"</span><span> . </span><span class="vars">$f</span><span>-&gt;buildPhotoURL(</span><span class="vars">$photo</span><span>, </span><span class="string">&#8220;Square&#8221;</span><span>) . </span><span class="string">&#8220;\&#8221; width=\&#8221;75\&#8221; height=\&#8221;75\&#8221; alt=\&#8221;$photo[title]\&#8221; /&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// close link </span><span> </span></span></li>
<li class="alt"><span> <span class="func">echo</span><span> </span><span class="string">&#8220;&lt;/a&gt;&#8221;</span><span>; </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// end loop</span><span> </span></span></li>
<li><span>} </span></li>
<li class="alt"><span>?&gt; </span></li>
<li><span> </span></li>
<li class="alt"><span>&lt;/div&gt;&lt;!&#8211; close thumbs div &#8211;&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;?php
// loop through each photo

 foreach ($photos['photos']['photo'] as $photo) {

// print out a link to the photo page, attaching the id of the photo
         echo "&lt;a href=\"photo.php?id=$photo[id]\" title=\"View $photo[title]\"&gt;";

// This next line uses buildPhotoURL to construct the location of our image, and we want the 'Square' size
// It also gives the image an alt attribute of the photo's title
       echo "&lt;img src=\"" . $f-&gt;buildPhotoURL($photo, "Square") .  "\" width=\"75\" height=\"75\" alt=\"$photo[title]\" /&gt;";

// close link 
      echo "&lt;/a&gt;";

// end loop
}
?&gt;

&lt;/div&gt;&lt;!-- close thumbs div --&gt;</pre>
<p>We’re almost done with the main page.  Chances are, you have more than 21 photos in your Photostream; so we’ll need to add some paging with some Previous and Next links so we can  move to the next 21 thumbnails. The links look like this:</p>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/pagination-example.png" alt="Pagination example" width="252" height="117" /></div>
<p>This  code relies on the line we had at the top calling the $page  variable. When our code calls in the photos from Flickr, it also uses  the $page variable to know where to start – look back at the line where  we called ‘people_getPublicPhotos’ and you’ll see that we passed in the $page  variable there as well. That value is the backbone of this little paging  arrangement. We’ll open a paragraph with the id of ‘nav’, open up the PHP tags, and define our ‘back’ and ‘next’ variables:</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;p id=</span><span class="string">&#8220;nav&#8221;</span><span>&gt; </span></span></li>
<li><span>&lt;?php </span></li>
<li class="alt"><span><span class="comment">// Some simple paging code to add Prev/Next to scroll through the thumbnails</span><span> </span></span></li>
<li><span><span class="vars">$back</span><span> = </span><span class="vars">$page</span><span> - 1; </span></span></li>
<li class="alt"><span><span class="vars">$next</span><span> = </span><span class="vars">$page</span><span> + 1; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;p id="nav"&gt;

&lt;?php
// Some simple paging code to add Prev/Next to scroll through the thumbnails
$back = $page - 1;
$next = $page + 1;</pre>
<p>Next we handle the actual ‘Previous’  and ‘Next’ links by checking that we’re not on the first or last page,  the close off php and close the ‘p’ tag.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span class="comment">// if it&#8217;s not the first page</span><span> </span></span></li>
<li><span><span class="keyword">if</span><span>(</span><span class="vars">$page</span><span> &gt; 1) { </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="string">&#8220;&lt;a href=&#8217;?page=$back&#8217;&gt;&amp;laquo; &lt;strong&gt;Prev&lt;/strong&gt;&lt;/a&gt;&#8221;</span><span>; </span></span></li>
<li><span>} </span></li>
<li class="alt"><span><span class="comment">// if not last page</span><span> </span></span></li>
<li><span><span class="keyword">if</span><span>(</span><span class="vars">$page</span><span> != </span><span class="vars">$pages</span><span>) { </span></span></li>
<li class="alt"><span><span class="func">echo</span><span> </span><span class="string">&#8220;&lt;a href=&#8217;?page=$next&#8217;&gt;&lt;strong&gt;Next&lt;/strong&gt; &amp;raquo;&lt;/a&gt;&#8221;</span><span>;} </span></span></li>
<li><span>?&gt; </span></li>
<li class="alt"><span>&lt;/p&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">// if it's not the first page
if($page &gt; 1) {
echo "&lt;a href='?page=$back'&gt;&amp;laquo; &lt;strong&gt;Prev&lt;/strong&gt;&lt;/a&gt;";
}
// if not last page
if($page != $pages) {
echo "&lt;a href='?page=$next'&gt;&lt;strong&gt;Next&lt;/strong&gt; &amp;raquo;&lt;/a&gt;";}
?&gt;

&lt;/p&gt;</pre>
<p>Now we refer back to some values we had at the beginning to display a little more about where we are in the gallery:</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span><span class="comment">// a quick bit of info about where we are in the gallery</span><span> </span></span></li>
<li class="alt"><span><span class="func">echo</span><span class="string">&#8220;&lt;p&gt;Page $page of $pages&lt;/p&gt;&#8221;</span><span>; </span></span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;p&gt;$total photos in the gallery&lt;/p&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span>?&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;?php
// a quick bit of info about where we are in the gallery
echo"&lt;p&gt;Page $page of $pages&lt;/p&gt;";
echo"&lt;p&gt;$total photos in the gallery&lt;/p&gt;";
?&gt;</pre>
<p>And to abide by Flickr’s terms and finish the page off, we’ll add:</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;p&gt;This product uses the Flickr API but is not endorsed </span><span class="keyword">or</span><span> certified by Flickr.&lt;/p&gt; </span></span></li>
<li><span> </span></li>
<li class="alt"><span>&lt;/body&gt; </span></li>
<li><span>&lt;/html&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;p&gt;This product uses the Flickr API but is not endorsed or certified by Flickr.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>That’s everything we need to produce a page that displays the latest 21 photos as thumbnails with a simple Prev / Next navigation.  Just like <a title="the homepage on the demo" href="http://nettuts-fd.iampaulburgess.co.uk">the homepage on the demo</a>. Next up: the page that displays our photo.</p>
<h3>Step 5 – Build a Page to Display Single Photos</h3>
<div class="tutorial_image"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/491_flickr/singlePage.jpg" alt="Single Page" /></div>
<p>Now that we have our thumbnails, we need a page to show the full image  when one is clicked on. Here is the code for photo.php, which the  thumbnails link. We start this page similarly to the index page, but instead  of the page number, we want the id of the photo which has been passed  in the url from our thumbnail page:</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// Get id of photo</span><span> </span></span></li>
<li><span><span class="vars">$id</span><span> = isset(</span><span class="vars">$_GET</span><span>[</span><span class="string">'id'</span><span>]) ? </span><span class="vars">$_GET</span><span>[</span><span class="string">'id'</span><span>] : NULL; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">//include the core file</span><span> </span></span></li>
<li class="alt"><span><span class="keyword">require_once</span><span>(</span><span class="string">&#8216;phpFlickr.php&#8217;</span><span>); </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// Fire up the main phpFlickr class</span><span> </span></span></li>
<li><span><span class="vars">$f</span><span> = </span><span class="keyword">new</span><span> phpFlickr(</span><span class="vars">$key</span><span>); </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// cache folder again, permissions set to 777</span><span> </span></span></li>
<li class="alt"><span><span class="vars">$f</span><span>-&gt;enableCache(</span><span class="string">&#8220;fs&#8221;</span><span>, </span><span class="string">&#8220;cache&#8221;</span><span>); </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;?php

// Get id of photo
$id = isset($_GET['id']) ? $_GET['id'] : NULL;

//include the core file
require_once('phpFlickr.php');

// Fire up the main phpFlickr class
$f = new phpFlickr($key);

// cache folder again, permissions set to 777
$f-&gt;enableCache("fs", "cache");</pre>
<p>Now we need to gather some info from  Flickr about the photo such as the photo’s id number, its dimensions,  where it sits in relation to other photos (context) and the url of the  image.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span class="comment">// access the getInfo method, passing in the photo&#8217;s id</span><span> </span></span></li>
<li><span><span class="vars">$photo</span><span> = </span><span class="vars">$f</span><span>-&gt;photos_getInfo(</span><span class="string">&#8220;$id&#8221;</span><span>, </span><span class="vars">$secret</span><span> = NULL); </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// pass the photo&#8217;s id to the getSizes method to get the dimensions of our image</span><span> </span></span></li>
<li class="alt"><span><span class="vars">$photosize</span><span> = </span><span class="vars">$f</span><span>-&gt;photos_getSizes(</span><span class="string">&#8220;$id&#8221;</span><span>, </span><span class="vars">$secret</span><span> = NULL); </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// we want the dimensions of the medium size which we get from the $photosize array in the previous line</span><span> </span></span></li>
<li><span><span class="vars">$size</span><span> = </span><span class="vars">$photosize</span><span>[3]; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// again passing the photo&#8217;s id through we get the context, which tells us which photos are before and after the current id</span><span> </span></span></li>
<li class="alt"><span><span class="vars">$context</span><span> = </span><span class="vars">$f</span><span>-&gt;photos_getContext(</span><span class="string">&#8220;$id&#8221;</span><span>); </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">//  the buildPhotoURL method does pretty much what you&#8217;d expect - build the  photo URL, we pass in $photo and the size we require to return the  image URL e.g.  http://farm4.static.flickr.com/3108/3175330082_0bf4b22e47.jpg</span><span> </span></span></li>
<li><span><span class="vars">$photoUrl</span><span> = </span><span class="vars">$f</span><span>-&gt;buildPhotoURL(</span><span class="vars">$photo</span><span>, </span><span class="string">&#8220;Medium&#8221;</span><span>); </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// This tells us who the owner of the photo is.</span><span> </span></span></li>
<li class="alt"><span><span class="comment">// This is an important part to include as we want our gallery to show  only our photos and not pull in other users&#8217; photos - more of an  explanation about this in the notes at the end</span><span> </span></span></li>
<li><span><span class="vars">$owner</span><span> = </span><span class="vars">$photo</span><span>[</span><span class="string">"owner"</span><span>][</span><span class="string">"username"</span><span>]; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// We only want the photo if it belongs to us - so if our username  is the same as the owner of the photo&#8230; we&#8217;ll write out the page and  show it</span><span> </span></span></li>
<li class="alt"><span><span class="comment">// more info on this at the end of the tutorial</span><span> </span></span></li>
<li><span><span class="keyword">if</span><span>(</span><span class="vars">$username</span><span> == </span><span class="vars">$owner</span><span>){ </span></span></li>
<li class="alt"><span>?&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">// access the getInfo method, passing in the photo's id
$photo = $f-&gt;photos_getInfo("$id", $secret = NULL);

// pass the photo's id to the getSizes method to get the dimensions of our image
$photosize = $f-&gt;photos_getSizes("$id", $secret = NULL);

// we want the dimensions of the medium size which we get from the $photosize array in the previous line
$size = $photosize[3];

// again passing the photo's id through we get the context, which tells us which photos are before and after the current id
$context = $f-&gt;photos_getContext("$id");

//  the buildPhotoURL method does pretty much what you'd expect - build the  photo URL, we pass in $photo and the size we require to return the  image URL e.g.  http://farm4.static.flickr.com/3108/3175330082_0bf4b22e47.jpg
$photoUrl = $f-&gt;buildPhotoURL($photo, "Medium");

// This tells us who the owner of the photo is.
// This is an important part to include as we want our gallery to show  only our photos and not pull in other users' photos - more of an  explanation about this in the notes at the end
$owner = $photo["owner"]["username"];

// We only want the photo if it belongs to us - so if our username  is the same as the owner of the photo... we'll write out the page and  show it
// more info on this at the end of the tutorial
if($username == $owner){
?&gt;</pre>
<p>Now we are primed for the rest of the page with the juicy bits.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;!DOCTYPE html  PUBLIC </span><span class="string">&#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</span><span> </span></span></li>
<li><span><span class="string">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;</span><span>&gt; </span></span></li>
<li class="alt"><span>&lt;html&gt; </span></li>
<li><span>&lt;head&gt; </span></li>
<li class="alt"><span>&lt;meta http-equiv=<span class="string">&#8220;Content-Type&#8221;</span><span> content=</span><span class="string">&#8220;text/html; charset=iso-8859-1&#8243;</span><span> /&gt; </span></span></li>
<li><span>&lt;!&#8211; Let<span class="string">&#8216;s get in there straight away and get the photo&#8217;</span><span>s title &#8211;&gt; </span></span></li>
<li class="alt"><span>&lt;title&gt; </span></li>
<li><span>&lt;?php </span></li>
<li class="alt"><span><span class="comment">// We access the $photo array and grab the title of the photo to use as the document title</span><span> </span></span></li>
<li><span><span class="func">echo</span><span> </span><span class="vars">$photo</span><span>[title] </span></span></li>
<li class="alt"><span> ?&gt; </span></li>
<li><span>&lt;/title&gt; </span></li>
<li class="alt"><span>&lt;link href=<span class="string">&#8220;styles.css&#8221;</span><span> rel=</span><span class="string">&#8220;stylesheet&#8221;</span><span> type=</span><span class="string">&#8220;text/css&#8221;</span><span>&gt; </span></span></li>
<li><span>&lt;/head&gt; </span></li>
<li class="alt"><span> </span></li>
<li><span>&lt;body&gt; </span></li>
<li class="alt"><span> </span></li>
<li><span>&lt;h1&gt;Photo gallery&lt;/h1&gt; </span></li>
<li class="alt"><span> </span></li>
<li><span>&lt;div id=<span class="string">&#8220;photo&#8221;</span><span>&gt; </span></span></li>
<li class="alt"><span>&lt;?php </span></li>
<li><span><span class="comment">// The photo&#8217;s title once again</span><span> </span></span></li>
<li class="alt"><span><span class="func">echo</span><span class="string">&#8220;&lt;h2&gt;$photo[title]&lt;/h2&gt;&#8221;</span><span>; </span></span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// The photo itself, you&#8217;ll recognise $photoUrl from above where we  built the photo&#8217;s url, we are also accessing the $size array that we  prepared earlier to get the width and height</span><span> </span></span></li>
<li><span><span class="comment">// and the title once again</span><span> </span></span></li>
<li class="alt"><span><span class="comment">// We&#8217;ll also make it link to the version on Flickr for good measure</span><span> </span></span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;a href=\&#8221;http://flickr.com/photos/$username/$photo[id]/\&#8221; title=\&#8221;View $photo[title] on Flickr \&#8221;&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span><span class="func">echo</span><span class="string">&#8220;&lt;img src=\&#8221;$photoUrl\&#8221; width=\&#8221;$size[width]\&#8221; height=\&#8221;$size[height]\&#8221; alt=\&#8221;$photo[title]\&#8221; /&gt;&#8221;</span><span>; </span></span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;/a&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="comment">// The photo&#8217;s description</span><span> </span></span></li>
<li class="alt"><span><span class="func">echo</span><span class="string">&#8220;&lt;p&gt;$photo[description]&lt;/p&gt;&#8221;</span><span>; </span></span></li>
<li><span>?&gt; </span></li>
<li class="alt"><span>&lt;/div&gt;&lt;!&#8211; <span class="func">end</span><span> photo &#8211;&gt; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;!-- Let's get in there straight away and get the photo's title --&gt;
&lt;title&gt;
&lt;?php
// We access the $photo array and grab the title of the photo to use as the document title
echo $photo[title]
 ?&gt;
&lt;/title&gt;
&lt;link href="styles.css" rel="stylesheet" type="text/css"&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;h1&gt;Photo gallery&lt;/h1&gt;

&lt;div id="photo"&gt;
&lt;?php
// The photo's title once again
echo"&lt;h2&gt;$photo[title]&lt;/h2&gt;";

// The photo itself, you'll recognise $photoUrl from above where we  built the photo's url, we are also accessing the $size array that we  prepared earlier to get the width and height
// and the title once again
// We'll also make it link to the version on Flickr for good measure
echo"&lt;a href=\"http://flickr.com/photos/$username/$photo[id]/\" title=\"View $photo[title] on Flickr \"&gt;";
echo"&lt;img src=\"$photoUrl\" width=\"$size[width]\" height=\"$size[height]\" alt=\"$photo[title]\" /&gt;";
echo"&lt;/a&gt;";

// The photo's description
echo"&lt;p&gt;$photo[description]&lt;/p&gt;";
?&gt;

&lt;/div&gt;&lt;!-- end photo --&gt;</pre>
<p>Now we have our photo… and we are almost done. This last bit may look a bit tricky but don’t be put off by it. It has to do with the photo’s context, as in, which photo comes next in  the stream and which one was previous to it. Just like you see on  people’s Flickr galleries. The reason there seems a lot of code is because for this to work best,  we have to check to see if there is a photo before or after the current  photo. If there isn’t, we don’t want a link, instead we insert normal  text and a dummy image (noimg.png).</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;div id=</span><span class="string">&#8220;context&#8221;</span><span>&gt; </span></span></li>
<li><span>&lt;?php </span></li>
<li class="alt"><span><span class="comment">// if there is a previous photo&#8230;</span><span> </span></span></li>
<li><span><span class="keyword">if</span><span>(</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'id'</span><span>]){</span><span class="func">echo</span><span class="string">&#8220;&lt;a  href=\&#8221;?id=&#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'id'</span><span>].</span><span class="string">&#8220;\&#8221; title=\&#8221;Prev:  &#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'title'</span><span>].</span><span class="string">&#8220;\&#8221;&gt;&lt;img  src=\&#8221;"</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'thumb'</span><span>].</span><span class="string">&#8220;\&#8221; width=\&#8221;75\&#8221; height=\&#8221;75\&#8221;  /&gt;&lt;/a&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span> </span></li>
<li><span>} <span class="keyword">else</span><span> { </span></span></li>
<li class="alt"><span><span class="comment">// if not - show the blank filler image</span><span> </span></span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;img src=\&#8221;noimg.png\&#8221; width=\&#8221;75\&#8221; height=\&#8221;75\&#8221; alt=\&#8221;No photo\&#8221; /&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span>}; </span></li>
<li><span> </span></li>
<li class="alt"><span><span class="comment">// if there is a next photo&#8230;</span><span> </span></span></li>
<li><span><span class="keyword">if</span><span>(</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'id'</span><span>]){</span><span class="func">echo</span><span> </span><span class="string">&#8220;&lt;a  href=\&#8221;?id=&#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'id'</span><span>].</span><span class="string">&#8220;\&#8221; title=\&#8221;Next:  &#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'title'</span><span>].</span><span class="string">&#8220;\&#8221;&gt;&lt;img  src=\&#8221;"</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'thumb'</span><span>].</span><span class="string">&#8220;\&#8221; width=\&#8221;75\&#8221; height=\&#8221;75\&#8221;  /&gt;&lt;/a&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span>} <span class="keyword">else</span><span> { </span></span></li>
<li><span><span class="comment">// if not - show the blank filler image</span><span> </span></span></li>
<li class="alt"><span><span class="func">echo</span><span class="string">&#8220;&lt;img src=\&#8221;noimg.png\&#8221; width=\&#8221;75\&#8221; height=\&#8221;75\&#8221; alt=\&#8221;No photo\&#8221; /&gt;&#8221;</span><span>; </span></span></li>
<li><span>}; </span></li>
<li class="alt"><span> </span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;/div&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span> </span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;p&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span><span class="comment">// if there is a previous link, write a link - if not, just the text</span><span> </span></span></li>
<li><span><span class="keyword">if</span><span>(</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'id'</span><span>]){</span><span class="func">echo</span><span class="string">&#8220;&lt;a  href=\&#8221;?id=&#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'id'</span><span>].</span><span class="string">&#8220;\&#8221; title=\&#8221;Prev:  &#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'prevphoto'</span><span>][</span><span class="string">'title'</span><span>].</span><span class="string">&#8220;\&#8221;&gt;&amp;laquo; Prev&lt;/a&gt;&#8221;</span><span>;} </span><span class="keyword">else</span><span> {</span><span class="func">echo</span><span class="string">&#8220;&amp;laquo; Prev&#8221;</span><span>;}; </span></span></li>
<li class="alt"><span><span class="func">echo</span><span class="string">&#8220; | &#8221;</span><span>; </span></span></li>
<li><span><span class="comment">// if there is a next link, write a link - if not, just the text</span><span> </span></span></li>
<li class="alt"><span><span class="keyword">if</span><span>(</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'id'</span><span>]){</span><span class="func">echo</span><span class="string">&#8220;&lt;a  href=\&#8221;?id=&#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'id'</span><span>].</span><span class="string">&#8220;\&#8221; title=\&#8221;Next:  &#8221;</span><span>.</span><span class="vars">$context</span><span>[</span><span class="string">'nextphoto'</span><span>][</span><span class="string">'title'</span><span>].</span><span class="string">&#8220;\&#8221;&gt;Next  &amp;raquo;&lt;/a&gt;&#8221;</span><span>;}</span><span class="keyword">else</span><span> {</span><span class="func">echo</span><span class="string">&#8220;Next &amp;raquo;&#8221;</span><span>;}; </span></span></li>
<li><span><span class="func">echo</span><span class="string">&#8220;&lt;/p&gt;&#8221;</span><span>; </span></span></li>
<li class="alt"><span>?&gt; </span></li>
<li><span> </span></li>
<li class="alt"><span>&lt;/div&gt;&lt;!&#8211; <span class="func">end</span><span> context &#8211;&gt; </span></span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;div id="context"&gt;

&lt;?php
// if there is a previous photo...
if($context['prevphoto']['id']){echo"&lt;a  href=\"?id=".$context['prevphoto']['id']."\" title=\"Prev:  ".$context['prevphoto']['title']."\"&gt;&lt;img  src=\"".$context['prevphoto']['thumb']."\" width=\"75\" height=\"75\"  /&gt;&lt;/a&gt;";

} else {
// if not - show the blank filler image
echo"&lt;img src=\"noimg.png\" width=\"75\" height=\"75\" alt=\"No photo\" /&gt;";
};

// if there is a next photo...
if($context['nextphoto']['id']){echo "&lt;a  href=\"?id=".$context['nextphoto']['id']."\" title=\"Next:  ".$context['nextphoto']['title']."\"&gt;&lt;img  src=\"".$context['nextphoto']['thumb']."\" width=\"75\" height=\"75\"  /&gt;&lt;/a&gt;";
} else {
// if not - show the blank filler image
echo"&lt;img src=\"noimg.png\" width=\"75\" height=\"75\" alt=\"No photo\" /&gt;";
};

echo"&lt;/div&gt;";

echo"&lt;p&gt;";
// if there is a previous link, write a link - if not, just the text
if($context['prevphoto']['id']){echo"&lt;a  href=\"?id=".$context['prevphoto']['id']."\" title=\"Prev:  ".$context['prevphoto']['title']."\"&gt;&amp;laquo; Prev&lt;/a&gt;";}  else {echo"&amp;laquo; Prev";};
echo" | ";
// if there is a next link, write a link - if not, just the text
if($context['nextphoto']['id']){echo"&lt;a  href=\"?id=".$context['nextphoto']['id']."\" title=\"Next:  ".$context['nextphoto']['title']."\"&gt;Next  &amp;raquo;&lt;/a&gt;";}else {echo"Next &amp;raquo;";};
echo"&lt;/p&gt;";
?&gt;

&lt;/div&gt;&lt;!-- end context --&gt;</pre>
<p>And to finish the page off, we’ll include a link back to the main gallery, a bit of text for Flickr and close off the html.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;p&gt;&amp;laquo; &lt;a href=</span><span class="string">&#8220;/&#8221;</span><span>&gt;Main gallery&lt;/a&gt;&lt;/p&gt; </span></span></li>
<li><span> </span></li>
<li class="alt"><span>&lt;!&#8211; To abide by Flickr&#8217;s terms - you must <span class="keyword">include</span><span> this text &#8211;&gt; </span></span></li>
<li><span>&lt;p&gt;This product uses the Flickr API but is not endorsed <span class="keyword">or</span><span> certified by Flickr.&lt;/p&gt; </span></span></li>
<li class="alt"><span> </span></li>
<li><span>&lt;/body&gt; </span></li>
<li class="alt"><span>&lt;/html&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;p&gt;&amp;laquo; &lt;a href="/"&gt;Main gallery&lt;/a&gt;&lt;/p&gt;

&lt;!-- To abide by Flickr's terms - you must include this text --&gt;
&lt;p&gt;This product uses the Flickr API but is not endorsed or certified by Flickr.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Hold up! One more thing… we finish the if  statement from just before the html began… again, see the notes at  the end about why we do this.</p>
<div class="dp-highlighter">
<ol class="dp-c">
<li class="alt"><span><span>&lt;?php </span></span></li>
<li><span>} <span class="comment">// end if for owner</span><span> </span></span></li>
<li class="alt"><span>?&gt; </span></li>
</ol>
</div>
<pre class="php" style="display: none;">&lt;?php
} // end if for owner
?&gt;</pre>
<p>And there you have it. A photo gallery for your website, powered by your Flickr account. <a id="yn2." title="Take a look at the demo page" href="http://nettuts-fd.iampaulburgess.co.uk">Take a look at the demo page</a> to review how it looks with a bit of extra markup and styling added. This  is a very basic implementation of the Flickr API; it just scratches the  surface of what you can do, but it does provides a nice photo gallery  for your site/blog which you can easily update and maintain via Flickr.</p>
<h3>NOTES &amp; EXTRAS</h3>
<ul>
<li>In this tutorial we are retrieving a user’s public photos. Within photo.php, we  reference $owner in this tutorial. At this point we are ensuring that  the photo displayed belongs to the owner of the photograph. If we leave  this out, your photo page can pull in any user’s public photo, and that  is obviously not what we want. This goes back to the advice Flickr provides in <a href="http://www.flickr.com/guidelines.gne">their guidelines</a>.<em> </em>
<p><em>You should use the  API to access your own images only or those which you have  permission to use. If you display someone else’s pictures, you should mention the name of image owner and name of the image. Flickr also say &#8220;…pages on other web sites that display content hosted on flickr.com must  provide a link from each photo or video back to its page on Flickr.”</em></li>
<li>There  are other ways to display your photos using the search method in the  API, but it is a bit more complicated and requires you to provide  authentication – in other words, use the API to log in and let Flickr  know it really is you – more info on that can be found <a href="http://phpflickr.com/docs/flickr-authentication/">here.</a></li>
<li> This demo is a very simple example of what you can do with the Flickr  API. You can take it much further and in fact do pretty much everything  Flickr does: get photo sets, show tags and comments, display private  photos, even upload images. Take a look at the API documentation here:  http://www.flickr.com/services/api/ You can cross check the methods  against the phpFlickr.php file.</li>
<li> Just  as we called in our photos using $photos =  $f-&gt;people_getPublicPhotos($nsid, NULL, 21, $page); you can do the  same with a set. For example, $photos =  $f-&gt;photosets_getPhotos(“$set”, $extras, $privacyfilter, 21, $page);  is a way to get 21 photos per page from a set, where $set = the set id  (something like 72157594488289220), then using foreach  ($photos['photo'] as $photo) {… to get the images etc.</li>
<li>If  you need to see which part of the array you need, you can use print_r()  to list out the array and see how to find to the value you need.  Surround it with &lt;pre&gt; tags to make the output legible.</li>
<li>The  file paths in this demo all work on the assumption that everything is  in the same folder (or all on the root) – feel free to move stuff about  but be sure to change the paths</li>
<li>Huge thanks to <a href="http://www.dancoulter.com/">Dan Coulter</a> for wrting the excellent <a href="http://phpflickr.com/">phpFlickr</a>. Be sure to take a look around the phpFlickr documentation:  <a href="http://phpflickr.com/docs/">http://phpflickr.com/docs/</a> for more tips and advice on taking things  further</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/how-to-create-photo-gallery-using-flickr-api.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Best Free HTML Editor for Download</title>
		<link>http://www.otakbali.com/best-free-html-editor-for-download.html</link>
		<comments>http://www.otakbali.com/best-free-html-editor-for-download.html#comments</comments>
		<pubDate>Wed, 23 Dec 2009 15:38:48 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://otakbali.com/best-free-html-editor-for-download/</guid>
		<description><![CDATA[One thing you will need when making simple web pages of your own, also known as &#8220;mini-sites&#8221;, and for other very simple tasks, is a web page editor. While you can do it in Microsoft Word, Wordpad and other text editors, many folks choose to start out by download the free program called Kompozer, formerly [...]]]></description>
			<content:encoded><![CDATA[<p>One thing you will need when making simple web pages of your own, also known as &#8220;mini-sites&#8221;, and for other very simple tasks, is a web page editor.</p>
<p> While you can do it in Microsoft Word, Wordpad and other text editors, many folks choose to start out by download the free program called Kompozer, formerly known as NVU. This type of html editor is known as WYSIWYG ( or What You See Is What You Get). </p>
<p>It saves a whole lot of work and study in your biginning stages of learning html coding.  You need to learn this before you move on to the more often used coding called xhtml.  Don&#8217;t worry, it will make alot more sense as you gain knowledge and experience. </p>
<p>The Graphical User Interface of Kompozer makes it very easy to use, but it is a powerful program. There are tutorials on how to use it online as well.</p>
<p>One way you will use Kompozer in a very simple fashion is to change the name on sales pages so that YOUR name appears on them. You can do other simple tasks like changing the price, adding a &#8220;form&#8221; from your autoresponder so you capture folks information such as their name and email, and more. These are all basic functions that are simple to do, and you should make sure you learn to do them as we progress. </p>
<p>So go download what could be the best freebie ever, Kompozer, and have a blast!</p>
<p>posted from SonyEricsson G502 handset.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/best-free-html-editor-for-download.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Images from mySQL Binary Data</title>
		<link>http://www.otakbali.com/display-images-from-mysql-binary-data.html</link>
		<comments>http://www.otakbali.com/display-images-from-mysql-binary-data.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 15:11:14 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=63</guid>
		<description><![CDATA[This tutorial will show you how to display your images (binary data) which has been saved in your mySQL database. It&#8217;s very very simple.. so.. simple&#8230;. (read also: Storing Images/Binary Files to mySQL in PHP) First of all we must connect to our database PHP Code: &#60;?php $username = ""; $password = ""; $host = [...]]]></description>
			<content:encoded><![CDATA[<div id="post_message_41500">This tutorial will show you how to display your images (binary data) which has been saved in your mySQL database.</div>
<div>It&#8217;s very very  simple.. so.. simple&#8230;. (read also: <a href="http://otakbali.com/storing-imagesbinary-files-to-mysql-in-php/"><strong>Storing Images/Binary Files to mySQL in PHP</strong></a>)</p>
<p>First of all we must connect to our database</p></div>
<div id="post_message_41500">
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 114px; text-align: left;" dir="ltr"><code><span style="color: #000000;"><span style="color: #0000bb;">&lt;?php<br />
$username </span><span style="color: #007700;">= </span><span style="color: #dd0000;">""</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$password </span><span style="color: #007700;">= </span><span style="color: #dd0000;">""</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$host </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"localhost"</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$database </span><span style="color: #007700;">= </span><span style="color: #dd0000;">""</span><span style="color: #007700;">;</span></p>
<p></span></code></div>
</div>
<p><strong><span id="more-63"></span>$username = &#8220;&#8221;;</strong> &#8211; It&#8217;s your database&#8217;s username<strong><br />
$password = &#8220;&#8221;;</strong> &#8211; It&#8217;s your database&#8217;s password<strong><br />
$host = &#8220;localhost&#8221;;</strong> &#8211; It&#8217;s your database&#8217;s host, usually it&#8217;s localhost but it can be something else also<strong><br />
$database = &#8220;&#8221;;</strong> &#8211; It&#8217;s your database</p>
<p>Now let&#8217;s connect to the database</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 66px; text-align: left;" dir="ltr"><code><span style="color: #000000;"><span style="color: #0000bb;"> </span><span style="color: #007700;">@</span><span style="color: #0000bb;">mysql_connect</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$host</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$username</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$password</span><span style="color: #007700;">) or die(</span><span style="color: #dd0000;">"Can not connect to database: "</span><span style="color: #007700;">.</span><span style="color: #0000bb;">mysql_error</span><span style="color: #007700;">());<br />
@</span><span style="color: #0000bb;">mysql_select_db</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$database</span><span style="color: #007700;">) or die(</span><span style="color: #dd0000;">"Can not select the database: "</span><span style="color: #007700;">.</span><span style="color: #0000bb;">mysql_error</span><span style="color: #007700;">()); </span></p>
<p></span><span style="color: #0000bb;"> </span></code></div>
</div>
<p><strong>@mysql_connect($host, $username, $password) or die(&#8220;Can not connect to database:&#8221;.mysql_error());</strong> &#8211; This connects to your database<br />
<strong><br />
@mysql_select_db($database) or die(&#8220;Can not select the database: &#8220;.mysql_error());</strong> &#8211; This will select your database</p>
<p>Now let&#8217;s get our id</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 34px; text-align: left;" dir="ltr"><code><span style="color: #000000;"><span style="color: #0000bb;">$id </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$_GET</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'id'</span><span style="color: #007700;">]; </span><span style="color: #0000bb;"> </span></span></code></div>
</div>
<p>It will get a id from an URL. <a href="http://blabla.com" target="_blank">blabla.com</a></p>
<p>So.. your id will be 3 and it will show an image which id is 3</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 66px; text-align: left;" dir="ltr"><code><span style="color: #000000;"><span style="color: #0000bb;"> </span><span style="color: #007700;">if(!isset(</span><span style="color: #0000bb;">$id</span><span style="color: #007700;">) || empty(</span><span style="color: #0000bb;">$id</span><span style="color: #007700;">)){<br />
die(</span><span style="color: #dd0000;">"Please select your image!"</span><span style="color: #007700;">);<br />
}else{</span></span></code></div>
</div>
<p><strong>if(!isset($id) || empty($id)){</strong> &#8211; If this ID in your url is empty like <em>?id=</em> of if it&#8217;s not even set<strong><br />
die(&#8220;Please select your image!&#8221;);</strong> &#8211; lets display an error<strong><br />
}else{</strong> &#8211; But if it is set let&#8217;s continue with showing our image</p>
<p><img class="tcattdimgresizer" src="http://forum.codecall.net/images/Tutorials/jaan/5x0vq0.jpg" border="0" alt="" /></p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 66px; text-align: left;" dir="ltr"><code style="white-space: nowrap;"><br />
<!-- php buffer start --></code><code><span style="color: #000000;"><span style="color: #0000bb;">$query </span><span style="color: #007700;">= </span><span style="color: #0000bb;">mysql_query</span><span style="color: #007700;">(</span><span style="color: #dd0000;">"SELECT * FROM tbl_images WHERE id='"</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$id</span><span style="color: #007700;">.</span><span style="color: #dd0000;">"'"</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$row </span><span style="color: #007700;">= </span><span style="color: #0000bb;">mysql_fetch_array</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$query</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$content </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$row</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'image'</span><span style="color: #007700;">]; </span></p>
<p></span></code></div>
</div>
<p><strong>$query = mysql_query(&#8220;SELECT * FROM tbl_images WHERE id=&#8217;&#8221;.$id.&#8221;&#8216;&#8221;);</strong> &#8211; Now let&#8217;s select the blob from the table where id is $id (for example: 3)</p>
<p><strong>$row = mysql_fetch_array($query);</strong> &#8211; Let&#8217;s gather our info about image which id is $id into one variable</p>
<p><strong>$content = $row['image'];</strong> &#8211; Get&#8217;s the blob from our table<br />
Now let&#8217;s display our image</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 82px; text-align: left;" dir="ltr"><code><span style="color: #000000;"><span style="color: #0000bb;">header</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'Content-type: image/jpg'</span><span style="color: #007700;">);<br />
echo </span><span style="color: #0000bb;">$content</span><span style="color: #007700;">;<br />
} </span></span></code></div>
</div>
<p><strong>header(&#8216;Content-type: image/jpg&#8217;);</strong> &#8211; This tells to the browser and to the server that this file will be a jpg file</p>
<p><strong>echo $content;</strong> &#8211; This will display our blob..</p>
<p><strong>}</strong> &#8211; Ends else<br />
Okay.. now here&#8217;s our full script.</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 450px; text-align: left;" dir="ltr"><code><span style="color: #000000;"><span style="color: #0000bb;">&lt;?php</p>
<p>$username</p>
<p></span><span style="color: #007700;">= </span><span style="color: #dd0000;">""</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$password </span><span style="color: #007700;">= </span><span style="color: #dd0000;">""</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$host </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"localhost"</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$database </span><span style="color: #007700;">= </span><span style="color: #dd0000;">""</span><span style="color: #007700;">;</p>
<p>@</p>
<p></span><span style="color: #0000bb;">mysql_connect</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$host</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$username</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$password</span><span style="color: #007700;">) or die(</span><span style="color: #dd0000;">"Can not connect to database: "</span><span style="color: #007700;">.</span><span style="color: #0000bb;">mysql_error</span><span style="color: #007700;">());</p>
<p>@</p>
<p></span><span style="color: #0000bb;">mysql_select_db</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$database</span><span style="color: #007700;">) or die(</span><span style="color: #dd0000;">"Can not select the database: "</span><span style="color: #007700;">.</span><span style="color: #0000bb;">mysql_error</span><span style="color: #007700;">());</p>
<p></span><span style="color: #0000bb;">$id </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$_GET</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'id'</span><span style="color: #007700;">];</p>
<p>if(!isset(</p>
<p></span><span style="color: #0000bb;">$id</span><span style="color: #007700;">) || empty(</span><span style="color: #0000bb;">$id</span><span style="color: #007700;">)){<br />
die(</span><span style="color: #dd0000;">"Please select your image!"</span><span style="color: #007700;">);<br />
}else{</p>
<p></span><span style="color: #0000bb;">$query </span><span style="color: #007700;">= </span><span style="color: #0000bb;">mysql_query</span><span style="color: #007700;">(</span><span style="color: #dd0000;">"SELECT * FROM tbl_images WHERE id='"</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$id</span><span style="color: #007700;">.</span><span style="color: #dd0000;">"'"</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$row </span><span style="color: #007700;">= </span><span style="color: #0000bb;">mysql_fetch_array</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$query</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$content </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$row</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'image'</span><span style="color: #007700;">];</p>
<p></span><span style="color: #0000bb;">header</span><span style="color: #007700;">(</span><span style="color: #dd0000;">'Content-type: image/jpg'</span><span style="color: #007700;">);<br />
echo </span><span style="color: #0000bb;">$content</span><span style="color: #007700;">;</p>
<p>}</p>
<p></span><span style="color: #0000bb;">?&gt;</span></span> </code><!-- php buffer end --></div>
</div>
<p>It works perfectly</p>
<p><img class="tcattdimgresizer" src="http://forum.codecall.net/images/Tutorials/jaan/ingvvq.jpg" border="0" alt="" /></p>
<p>Enjoy&#8230; <img src='http://www.otakbali.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />      If you have questions then please feel free to ask</div>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/display-images-from-mysql-binary-data.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Storing Images/Binary Files to mySQL in PHP</title>
		<link>http://www.otakbali.com/storing-imagesbinary-files-to-mysql-in-php.html</link>
		<comments>http://www.otakbali.com/storing-imagesbinary-files-to-mysql-in-php.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 13:58:06 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=59</guid>
		<description><![CDATA[how to store images, audio, or another binary files into mySQL database with PHP script. cara menyimpan gambar ke mysql dengan PHP.]]></description>
			<content:encoded><![CDATA[<p>It is possible for us to store/save our images (binary files) into a mySQL database in PHP. In this article, we will discuss about &#8220;how to store images, audio, or another binary files into mySQL database with PHP script&#8221;. But, before we continue to the further step, you might want to consider some reason of why we should and why we shouldn&#8217;t store binary files in a database:</p>
<p>Reasons to store your images (binary files) in a database:</p>
<ol style="list-style-type: decimal;">
<li>Storing in a database allows better security for your files and images.</li>
<li>Eliminates messy directory and file structures (this is especially true when users are allow to contribute files).</li>
<li>Files/Images can be stored directly linking to user or advertiser information.<span id="more-59"></span></li>
</ol>
<p>You may want to reconsider storing your binary files in the database.  Here are some reason you may not want to:</p>
<ol style="list-style-type: decimal;">
<li>You can&#8217;t directly access your files using standard applications such as FTP.</li>
<li>If you database becomes corrupt, so do your files.</li>
<li>Migrating to a new database is made more difficult</li>
<li>Pulling images from a database and displaying them is slower than using file access.</li>
</ol>
<p>After considering above reasons, you may continue to the first step of this tutorial.</p>
<p><span style="font-size: medium;">Database Type and Connection</span></p>
<p>I assume that you already create a mySQL database named &#8220;binary&#8221;. We created two tables, one the primary ID (of the row/entry) and the binary BLOB. A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types are TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB. These differ only in the maximum length of the values they can hold. The four TEXT types are TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. These correspond to the four BLOB types and have the same maximum lengths and storage requirements.</p>
<p>You&#8217;ve now created your database and are ready to upload binary files to it. In this case, images. Next we will create a simple upload script.</p>
<p><span style="font-size: medium;">Creating the HTML</span></p>
<p>Creating the user interface where you or your visitors will upload files is very simple.  Using basic HTML and relying on the browser to do most of the heavy lifting you can easily create an upload form.  Here is the one we will use:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">HTML Code:</div>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 82px; text-align: left;" dir="ltr"><span style="color: #ff8000;">&lt;form enctype=<span style="color: #0000ff;">"multipart/form-data"</span> action=<span style="color: #0000ff;">"insert.php"</span> method=<span style="color: #0000ff;">"post"</span> name=<span style="color: #0000ff;">"changer"</span>&gt;</span>

<span style="color: #ff8000;">&lt;input name=<span style="color: #0000ff;">"MAX_FILE_SIZE"</span> value=<span style="color: #0000ff;">"102400"</span> type=<span style="color: #0000ff;">"hidden"</span>&gt;</span>
<span style="color: #ff8000;">&lt;input name=<span style="color: #0000ff;">"image"</span> accept=<span style="color: #0000ff;">"image/jpeg"</span> type=<span style="color: #0000ff;">"file"</span>&gt;</span>

<span style="color: #ff8000;">&lt;input value=<span style="color: #0000ff;">"Submit"</span> type=<span style="color: #0000ff;">"submit"</span>&gt;</span></pre>
</div>
<p>Copy this code into a file and save it as <strong>add.html</strong></p>
<p>The code above allows the uses to browse for a file and select any image/jpeg file type.   Once selected and the submit button is pressed the image contents are forwarded to PHP script, <strong>insert.php</strong></p>
<p><span style="font-size: medium;"><strong>Inserting the Image into MySQL</strong></span></p>
<p>Create a new file named insert.php.  If you change the name of this file you will also need to change the action=&#8221;" part in your HTML file above.  Open the file in your favorite text editor or PHP IDE.</p>
<p>Write or copy/paste this code into your file:</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 274px; text-align: left;" dir="ltr"><code style="white-space: nowrap;"><br />
<!-- php buffer start --></code><code><span style="color: #000000;"><br />
<span style="color: #0000bb;"> </span><span style="color: #ff8000;">// Create MySQL login values and<br />
// set them to your login information.<br />
</span><span style="color: #0000bb;">$username </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"YourUserName"</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$password </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"YourPassword"</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$host </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"localhost"</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$database </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"binary"</span><span style="color: #007700;">;</p>
<p></span><span style="color: #ff8000;">// Make the connect to MySQL or die<br />
// and display an error.<br />
</span><span style="color: #0000bb;">$link </span><span style="color: #007700;">= </span><span style="color: #0000bb;">mysql_connect</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$host</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$username</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$password</span><span style="color: #007700;">);<br />
if (!</span><span style="color: #0000bb;">$link</span><span style="color: #007700;">) {<br />
die(</span><span style="color: #dd0000;">'Could not connect: ' </span><span style="color: #007700;">. </span><span style="color: #0000bb;">mysql_error</span><span style="color: #007700;">());<br />
}</p>
<p></span><span style="color: #ff8000;">// Select your database<br />
</span><span style="color: #0000bb;">mysql_select_db </span><span style="color: #007700;">(</span><span style="color: #0000bb;">$database</span><span style="color: #007700;">);</p>
<p></span><span style="color: #0000bb;"> </span><br />
</span><br />
</code><!-- php buffer end --></div>
</div>
<p>The above code sets your connection variables, creates a connection to MySQL and selects your database (binary if you followed my instructions above).  Next we need to read the form data and insert it into the database.</p>
<div style="margin: 5px 20px 20px;">
<div class="smallfont" style="margin-bottom: 2px;">PHP Code:</div>
<div class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 500px; height: 498px; text-align: left;" dir="ltr">
<p><code style="white-space: nowrap;"><br />
<!-- php buffer start --></code><code><span style="color: #000000;"><br />
<span style="color: #0000bb;"> </span><span style="color: #ff8000;">// Make sure the user actually<br />
// selected and uploaded a file<br />
</span><span style="color: #007700;">if (isset(</span><span style="color: #0000bb;">$_FILES</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'image'</span><span style="color: #007700;">]) &amp;&amp; </span><span style="color: #0000bb;">$_FILES</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'image'</span><span style="color: #007700;">][</span><span style="color: #dd0000;">'size'</span><span style="color: #007700;">] &gt; </span><span style="color: #0000bb;">0</span><span style="color: #007700;">) {</span></span></code></p>
<p><span style="color: #ff8000;">// Temporary file name stored on the server<br />
</span><span style="color: #0000bb;">$tmpName </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$_FILES</span><span style="color: #007700;">[</span><span style="color: #dd0000;">'image'</span><span style="color: #007700;">][</span><span style="color: #dd0000;">'tmp_name'</span><span style="color: #007700;">];</span></p>
<p><span style="color: #ff8000;">// Read the file<br />
</span><span style="color: #0000bb;">$fp </span><span style="color: #007700;">= </span><span style="color: #0000bb;">fopen</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$tmpName</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8216;r&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">fread</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">, </span><span style="color: #0000bb;">filesize</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$tmpName</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">addslashes</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">fclose</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$fp</span><span style="color: #007700;">);</span></p>
<p><span style="color: #ff8000;">// Create the query and insert<br />
// into our database.<br />
</span><span style="color: #0000bb;">$query </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;INSERT INTO tbl_images &#8221;</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$query </span><span style="color: #007700;">.= </span><span style="color: #dd0000;">&#8220;(image) VALUES (&#8216;$data&#8217;)&#8221;</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$results </span><span style="color: #007700;">= </span><span style="color: #0000bb;">mysql_query</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$query</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$link</span><span style="color: #007700;">);</span></p>
<p><span style="color: #ff8000;">// Print results<br />
</span><span style="color: #007700;">print </span><span style="color: #dd0000;">&#8220;Thank you, your file has been uploaded.&#8221;</span><span style="color: #007700;">;</span></p>
<p>}<br />
else {<br />
print <span style="color: #dd0000;">&#8220;No image selected/uploaded&#8221;</span><span style="color: #007700;">;<br />
}</span></p>
<p><span style="color: #ff8000;">// Close our MySQL Link<br />
</span><span style="color: #0000bb;">mysql_close</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$link</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">?&gt;</span></p>
<p><!-- php buffer end --></div>
</div>
<p>The PHP code above takes the user selected image, reads it with fopen and stores the data in a variable named $data.  The binary data is then inserted into our database for retrieval at a later time.</p>
<p>Save the file above and access add.html via your browser.  Select an image file and upload it.</p>
<p>I will post the next stage of this tutorial: &#8220;<a href="http://otakbali.com/display Images-from-mySQL-binary-data"><strong>How to read binary data from database</strong></a>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/storing-imagesbinary-files-to-mysql-in-php.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Create RSS Feed in PHP</title>
		<link>http://www.otakbali.com/create-rss-feed-in-php.html</link>
		<comments>http://www.otakbali.com/create-rss-feed-in-php.html#comments</comments>
		<pubDate>Sun, 08 Nov 2009 15:32:12 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=56</guid>
		<description><![CDATA[This is the easiest way to build a RSS feed in PHP. Because we don&#8217;t have to modify the feed file (feed.xml, or another xml file) anymore every we adding more content into the site.. And here&#8217;s the key concept: Every the PHP file executed, the PHP file will output XML-based data to the browser [...]]]></description>
			<content:encoded><![CDATA[<p>This is the easiest way to build a RSS feed in PHP. Because we don&#8217;t have to modify the feed file (feed.xml, or another xml file) anymore every we adding more content into the site.. And here&#8217;s the key concept:</p>
<p>Every the PHP file executed, the PHP file will output XML-based data to the browser by modifiying the PHP&#8217;s header.</p>
<p>In order to output a XML-based data by PHP, you will need to put this line into the PHP script:</p>
<blockquote><p><strong>header(&#8216;Content-Type: text/xml; charset=UTF-8&#8242;, true);</strong></p></blockquote>
<p>the line above will send an xml file to your browser with XML format.<span id="more-56"></span></p>
<p>Now you will need to fill in the XML with RSS-formatted data, so the reader can read their RSS feed.</p>
<p>Below is the basic RSS format, you need some scripting basic to give the data into the XML.</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243; ?&gt;</p>
<p>&lt;rss version=&#8221;2.0&#8243;<br />
xmlns:content=&#8221;http://purl.org/rss/1.0/modules/content/&#8221;<br />
xmlns:wfw=&#8221;http://wellformedweb.org/CommentAPI/&#8221;<br />
xmlns:dc=&#8221;http://purl.org/dc/elements/1.1/&#8221;<br />
xmlns:atom=&#8221;http://www.w3.org/2005/Atom&#8221;<br />
xmlns:sy=&#8221;http://purl.org/rss/1.0/modules/syndication/&#8221;<br />
&gt;</p>
<p>&lt;channel&gt;<br />
&lt;title&gt;&lt;? echo $sitename;?&gt; RSS2 feed&lt;/title&gt;<br />
&lt;atom:link href=&#8221;&lt;? echo $sitepath;?&gt;rss.php&#8221; rel=&#8221;self&#8221; type=&#8221;application/rss+xml&#8221; /&gt;<br />
&lt;link&gt;&lt;? echo $sitepath;?&gt;feed&lt;/link&gt;<br />
&lt;description&gt;&lt;? echo $desc;?&gt;&lt;/description&gt;<br />
&lt;pubDate&gt;&lt;?php echo mysql2date(&#8216;D, d M Y H:i:s +0000&#8242;, $latest_post_date, false); ?&gt;&lt;/pubDate&gt;<br />
&lt;generator&gt;rss2&lt;/generator&gt;<br />
&lt;language&gt;en-us&lt;/language&gt;<br />
&lt;sy:updatePeriod&gt;hourly&lt;/sy:updatePeriod&gt;<br />
&lt;sy:updateFrequency&gt;1&lt;/sy:updateFrequency&gt;<br />
&lt;?<br />
$search = &#8220;SELECT * FROM $data_table order by id desc <strong>limit 10</strong>&#8220;;<br />
$query = mysql_query($search);<br />
while ($content = mysql_fetch_array($query))<br />
{<br />
?&gt;<br />
&lt;item&gt;<br />
&lt;title&gt;&lt;?=$content[title]?&gt;&lt;/title&gt;<br />
&lt;link&gt;&lt;?=$sitepath.$content[url];?&gt;&lt;/link&gt;<br />
&lt;comments&gt;&lt;?$sitepath.$content[url].&#8221;#comm&#8221;; ?&gt;&lt;/comments&gt;<br />
&lt;pubDate&gt;&lt;?php echo mysql2date(&#8216;D, d M Y H:i:s +0000&#8242;, $content[waktu], false); ?&gt;&lt;/pubDate&gt;<br />
&lt;dc:creator&gt;&lt;?=$content[user]?&gt;&lt;/dc:creator&gt;<br />
&lt;guid isPermaLink=&#8221;false&#8221;&gt;&lt;?=$sitepath.$content[url];?&gt;&lt;/guid&gt;<br />
&lt;description&gt;&lt;![CDATA[&lt;?=$content[pembuka]; ?&gt;]]&gt;&lt;/description&gt;<br />
&lt;content:encoded&gt;&lt;![CDATA[&lt;?=$content[pembuka]; ?&gt;]]&gt;&lt;/content:encoded&gt;<br />
&lt;wfw:commentRss&gt;&lt;?=$sitepath.&#8221;feed/comment/&#8221;;?&gt;&lt;/wfw:commentRss&gt;<br />
&lt;/item&gt;<br />
&lt;? } ?&gt;<br />
&lt;/channel&gt;<br />
&lt;/rss&gt;</p></blockquote>
<p>The number of feed is depend on how many <em>&lt;item&gt;</em> tag that exist in the XML file.. You may find the bolded words &#8220;<strong>limit 10</strong>&#8221; in the line above, that will cause the PHP will only call the latest 10 data and put it into ten <em>&lt;item&gt;</em> tags.</p>
<p>If there are some error in parsing or reading, you may validate the RSS feed at this address: http://validator.w3.org/feed/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/create-rss-feed-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>write less do more</title>
		<link>http://www.otakbali.com/write-less-do-more.html</link>
		<comments>http://www.otakbali.com/write-less-do-more.html#comments</comments>
		<pubDate>Tue, 27 Oct 2009 12:10:15 +0000</pubDate>
		<dc:creator>andi</dc:creator>
				<category><![CDATA[Tips n Trik]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://otakbali.com/?p=43</guid>
		<description><![CDATA[How to save the resource in our project code? Should we repeat writing the same code in every page/file? We can save a lot of our time and resource by putting the same code or lines into a function or procedure. In some programming language, such as Pascal, Batch, C, PHP, etc., we can make [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 267px"><a href="http://i720.photobucket.com/albums/ww207/andiim3/php.png"><img title="php" src="http://i720.photobucket.com/albums/ww207/andiim3/php.png" alt="PHP" width="257" height="167" /></a><p class="wp-caption-text">PHP</p></div>
<p>How to save the resource in our project code? Should we repeat writing the same code in every page/file? We can save a lot of our time and resource by putting the same code or lines into a function or procedure.</p>
<p>In some programming language, such as Pascal, Batch, C, PHP, etc., we can make a single special file where we can store our functions and procedure, also some constant.<span id="more-43"></span></p>
<p>Files which stored functions and procedures generally called &#8220;<strong>library</strong>&#8220;. The reason? coz it store many functions&#8230; I don&#8217;t know the other reasons.. <img src='http://www.otakbali.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>For some constant (variables that store fixed value), we can put it on a editable file, like &#8220;config.php&#8221; in PHP or &#8220;config.tpu&#8221; in Pascal. So if we need some constant, we only need to call that file.</p>
<p>For example, we have some web pages that require same coding and data, but in different web design, should we write the same codes in every page? and how if there&#8217;s a minor change in the codes? it will make us work on those page again.</p>
<p>We can solve that problem by creating a single file that contain the function, and call the function from every page. So, if there&#8217;s any change on the code, we have to modify the file that contain the function only. In PHP, you can also include the file with &#8220;include()&#8221; function rather than calling for the function.</p>
<p>There a lot of free library out there, so you can use them to decrease your time in coding. For example <strong><a href="http://docs.jquery.com/Downloading_jQuery">jQuery</a></strong>, it is a free javascript library that store many function. There&#8217;s also <strong><a href="http://mootools.net">Mootools</a></strong>, it&#8217;s has same function with jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otakbali.com/write-less-do-more.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
