<?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>Tips for Twits &#187; frontend</title>
	<atom:link href="http://t.wits.sg/tag/frontend/feed/" rel="self" type="application/rss+xml" />
	<link>http://t.wits.sg</link>
	<description>WARNING: excessive use of this site will increase MP at the expense of HP</description>
	<lastBuildDate>Mon, 14 Jun 2010 01:55:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Howto: Repackageable custom extension development in Magento &#8211; Part 9 &#8211; Frontend &#8211; List</title>
		<link>http://t.wits.sg/2009/06/22/howto-repackageable-custom-extension-development-in-magento-part-9-frontend-list/</link>
		<comments>http://t.wits.sg/2009/06/22/howto-repackageable-custom-extension-development-in-magento-part-9-frontend-list/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 07:47:13 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=327</guid>
		<description><![CDATA[Download the source for this entire series here! Frontend &#8211; List Let us revisit our frontend controller. Surely by now you&#8217;ve gotten a better grasp of the controller and models. So we&#8217;ll be revisiting those concepts here. So lets say you want to allow users to view you current Twits as well as create a [...]]]></description>
			<content:encoded><![CDATA[<div class="contentblock">
<h4>Download the source for this entire series here! <a href="http://t.wits.sg/downloadsmagento-tutorial.zip"><img src="http://t.wits.sg/wp-content/uploads/2009/03/download.png" alt="" title="download Magento Tutorial" /></a></h4>
</div>
<div class="h_l">
<div></div>
</div>
<h3>Frontend &#8211; List</h3>
<p>Let us revisit our frontend controller. Surely by now you&#8217;ve gotten a better grasp of the controller and models. So we&#8217;ll be revisiting those concepts here. So lets say you want to allow users to view you current Twits as well as create a new Tip. </p>
<ol>
<li>Some new file structure loving

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">app/
  design/
    frontend/
      base/
        default/
          template/
            twits/
              - tip_list.phtml
  etc/
    modules/
      - SavantDegrees_All.xml <span style="color: #66cc66;">&#40;</span>Or what ever your company name might be<span style="color: #66cc66;">&#41;</span>
  code/
    local/
      SavantDegrees/ <span style="color: #66cc66;">&#40;</span>Or what ever your company name might be<span style="color: #66cc66;">&#41;</span>
        Twits/ <span style="color: #66cc66;">&#40;</span>Or whatever your module name might be<span style="color: #66cc66;">&#41;</span>
          Block/
            Admin/
              - Main.php
              Main/
                - Grid.php
              - Edit.php
              Edit/
                - Form.php
              - New.php
              New/
                - Form.php
            - HelloWorld.php
            - Index.php
          controllers/
            - AdminController.php
            - IndexController.php
          etc/
            - config.xml
          Helper/
            - Data.php
          Model/
            - Tip.php
            Mysql4/
              - Tip.php
              Tip/
                - Collection.php
          sql/
            twits_setup/
              - mysql4-install-0.2.0.php
              - mysql4-upgrade-0.1.0-0.2.0.php</pre></div></div>

<p>We&#8217;ve added a whole nasty branch of subdirectories under <code>app/designs</code>. Read on to understand what its all for&#8230;
</li>
<li>Let us return to our <code>IndexController.php</code>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> SavantDegrees_Twits_IndexController <span style="color: #000000; font-weight: bold;">extends</span> Mage_Core_Controller_Front_Action
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> indexAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getBlock</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'content'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">append</span><span style="color: #009900;">&#40;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createBlock</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twits/index'</span><span style="color: #009900;">&#41;</span>
    	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">renderLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Hold your horses, this code is EXACTLY the same as the Part 1. Its just a revision. However, that being said, we see that in Part 1, we made the system create a <code>Block</code> called <code>index</code>. That&#8217;s an opening&#8230;</li>
<li>So let us modify our <code>Index.php</code> block:

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> SavantDegrees_Twits_Block_Index <span style="color: #000000; font-weight: bold;">extends</span> Mage_Core_Block_Template
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTemplate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twits/tip_list.phtml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTips<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    	<span style="color: #000088;">$model</span> <span style="color: #339933;">=</span> Mage<span style="color: #339933;">::</span><span style="color: #004000;">getModel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twits/tip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #000088;">$collection</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$model</span>
    	    	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCollection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    	    	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$collection</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getItems</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>What the difference here? We made the block load the template from <code>twits/tip_list.phtml</code>. We can create/find this file in <code>/app/design/frontend/default/default/template/twits/tip_list.phtml</code>. Some explanation is due here:
<ul>
<li>When you say <code>setTemplate</code> in the block, it means, use this file as the presentation/view</li>
<li>This file exists in the some subdirectory of <code>/app/design/frontend/default/default/template</code>. That is the path to your default template. Even though you may have other templates, this is the default 1. So when Magento cant find your template file in the other template directories, it always reverts back to this folder. Its a directory form of inheritance/ancestory/precedence.
<li>
</ul>
</li>
<li>Lastly, the <code>tip_list.phtml</code> file:

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;?php
$_tips = $this-&gt;getTips();
if ($_tips) {
	$count = 0;
	foreach ($_tips as $i=&gt;$tip) {
?&gt;
		&lt;div class=&quot;tip&quot;&gt;
			&lt;div class='title'&gt;&lt;?= $tip-&gt;getTitle() ?&gt;&lt;/div&gt;
			&lt;div class='author'&gt;&lt;?= $tip-&gt;getAuthor() ?&gt;&lt;/div&gt;
			&lt;p&gt;&lt;?= $tip-&gt;getContents() ?&gt;&lt;/p&gt;
		&lt;/div&gt;
&lt;?php
	}
}
?&gt;</pre></div></div>

<p>Since the whole purpose of <code>tip_list.phtml</code> is to prepare the view for the list of tips, it obviously needs to get the data from somewhere. It turns out, the <code>Template</code> is the extension of the <code>Block</code>. So by calling <code>$this->getTips()</code>, we&#8217;re calling the <code>Block's</code> <code>getTips()</code> method.
</li>
<li>There you have it! check your tips list at <a href="http://127.0.0.1/magento/index.php/twits">http://127.0.0.1/magento/index.php/twits</a></li>
<div class="h_l">
<div></div>
</div>
<p>If it works for you, leave a comment! =)</p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/22/howto-repackageable-custom-extension-development-in-magento-part-9-frontend-list/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 2.0</title>
		<link>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/</link>
		<comments>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 02:39:49 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=320</guid>
		<description><![CDATA[Hi all its us again, In the past few months we&#8217;ve been asked many a times to help improve the progressbar code. We&#8217;ve also been referenced by several websites as THE progressbar to use. In all, we felt we owed it to you guys to make it better. So here we are, after all those [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>Hi all its us again, In the past few months we&#8217;ve been asked many a times to help improve the progressbar code. We&#8217;ve also been referenced by several websites as THE progressbar to use. In all, we felt we owed it to you guys to make it better.</p>
<p>So here we are, after all those emails and bug reports, we finally got down to it. Always good to take a couple of months to have a fresh prespective of things. We ripped out the old code and made it much better and more extensible than its predecessors. So much that we decided it was enough to qualify as a major revision.</p>
<div style="clear: both">&nbsp;</div>
<p>Let see whats been done&#8230;</p>
<ul>
<li>Cleaned up the code, yes its lighter, cleaner faster. (Still lacks documentation though) <img src='http://t.wits.sg/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </li>
<li>Callbacks! Everyone&#8217;s favourite</li>
<li>Max values, you can now set it to be 150/2000 instead of just a percentage</li>
<li>Text formats. Show 75/100 or 75% by toggling the <code>textFormat</code> accordingly</li>
<li>Steps, how many steps to get to your target value</li>
<li>Step Duration, how long each step lasts</li>
<li>Webkit (Chrome/Safari) compatibility. More like, Webkit Hacks</li>
</ul>
<p>Once again, many a thanks for all those who have so generously provided the feature requests as well as bug fixes every now and then. And thanks for all your patience in waiting for this new release. <img src='http://t.wits.sg/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
If its working for you, drop us a comment and tell us where we can see your stuff!</p>
<p><strong>Download the new jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a>or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>HOWTO: Find icons for your new prototype system</title>
		<link>http://t.wits.sg/2009/06/14/howto-find-icons-for-your-new-prototype-system/</link>
		<comments>http://t.wits.sg/2009/06/14/howto-find-icons-for-your-new-prototype-system/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 14:08:11 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=284</guid>
		<description><![CDATA[Having a good UI is 30% of your customer won. No i dont know, 30% was completely arbitrary but absolutely believable. As such, please dont try to make those icons yourself! As all developers know, we try our best not to reinvent the wheel. Unless the wheel sucks and we have the budget, then we [...]]]></description>
			<content:encoded><![CDATA[<p>Having a good UI is 30% of your customer won. No i dont know, 30% was completely arbitrary but absolutely believable. As such, please dont try to make those icons yourself! As all developers know, we try our best not to reinvent the wheel. Unless the wheel sucks and we have the budget, then we knock ourselves out. <img src='http://t.wits.sg/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
So its time to share those little icon secrets! Where do you find nice icons!?</p>
<ul>
<li><strong><a href="http://www.famfamfam.com/">famfamfam</a></strong>. If you dont know this site, you should be SHOT. Mark James spent good time making a fantastic set of icons so that everyone else could use them. Kudos to him!</li>
<li><strong><a href="http://www.everaldo.com/crystal/?action=downloads">crystal icons</a></strong>Another awesome job done by Everaldo. Download link&#8217;s not working. Use <a href="http://www.crystalxp.net/galerie/num.4538.htm">this</a> instead. Made primarily for the KDE workspace. Which brings us to my next point</li>
<li>Any other Linux icons sources. These includes <a href="http://www.kde-look.org">kde-look</a>, <a href="http://tango.freedesktop.org/Tango_Icon_Library">tango</a>, <a href="http://interfacelift.com">interfacelift</a>, <a href="http://www.deviantart.com">deviantart</a></li>
<li><a href="http://www.iconfinder.net/">Iconfinder</a>. Its new, its awesome and apparently they&#8217;re license-friendly! If everything&#8217;s as promised, they&#8217;re gonna kick some serious internet butt! We&#8217;re fans already!</li>
<li>Ok we admit, sometimes we&#8217;re really tempted to use existing packages icons. <a href="http://joomla.org">Joomla</a> has a really nice set. <img src='http://t.wits.sg/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </li>
</ul>
<p>All in all, plenty of icons. And if that doesnt work out. Go buy some from <a href="http://www.istockphoto.com">istockphoto </a>and <a href="http://www.sxc.hu">stock.xchng</a>! They&#8217;re the pros for a good reason!<br />
And a final word in licensing. Respect it.  Not so much for the hard work, but more for the fact that designers can do what we cannot. Even if we tried, we probably wouldn&#8217;t have as much flair. Just like magicians.</p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/14/howto-find-icons-for-your-new-prototype-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Maps Helper</title>
		<link>http://t.wits.sg/2009/06/14/google-maps-helper/</link>
		<comments>http://t.wits.sg/2009/06/14/google-maps-helper/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 13:51:15 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=281</guid>
		<description><![CDATA[In our work we like to create Google Maps links for our client&#8217;s (offices, stores, etc). However, the larger our clients presence, the more random links there are bound to be. When it comes to using Google Map&#8217;s javascript API to control the map, thats still perfectly fine. But how do I create a google [...]]]></description>
			<content:encoded><![CDATA[<p>In our work we like to create Google Maps links for our client&#8217;s (offices, stores, etc). However, the larger our clients presence, the more random links there are bound to be. When it comes to using Google Map&#8217;s javascript API to control the map, thats still perfectly fine. But how do I create a google maps link that only shows 1 entry? Turns out, there are several ways to do this:</p>
<ol>
<li><strong>Manipulate the request such that it only shows your entry</strong>How? For example, searching for &#8220;Holland, Singapore&#8221; will lead us to about 1,356 results. See <a href="http://www.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=holland,+Singapore&amp;mrt=yp&amp;sll=1.305855,103.786876&amp;sspn=0.008055,0.016522&amp;ie=UTF8&amp;z=14">here</a>. So lets tweak it a little:
<ul>
<li>Append <code>&amp;mrt=yp</code> to the url &#8211; That returns us all the business listings. (852 results)</li>
<li>Append <code>&amp;start=16</code> to the url &#8211; That skips the first 16 results (Shows results 17-26 of 852)</li>
<li>Append <code>&amp;num=2</code> to the url &#8211; That returns us only 2 results (Only shows 2 results)</li>
</ul>
<p>For a more complete listing of Google Maps Parameters, consult <a href="http://mapki.com/wiki/Google_Map_Parameters">mapki.com</a>. Kudos to those guys for compiling that list. Really useful stuff<br />
So there you have it, a simple way to link your business such that its the only entry there. However this method is relatively dangerous. Why? Cause you&#8217;ve got no idea of the exact ordering that Google maps may return. Today you could be entry 17, surely not in a year (hopefully for the better). As such, this is not the recommended solution.</li>
<li><strong>Use the address with your long/lat coordinates to generate your entry.</strong>
<ul>
<li> First get your GPS coordinates, there are a number of ways to do this. Check our this <a href="http://en.wikipedia.org/wiki/Geographic_coordinates_(obtaining)">link</a></li>
<li>Then create your link via the following structure: <code>http://www.google.com/maps?&amp;ie=UTF8&amp;hl=en&amp;q=[urlescaped address]&amp;ll=[GPS lat,long]&amp;z=[Zoom]&amp;iwloc=A</code></li>
<li>Still too troublesome? We&#8217;ve created a simple tool for our clients to use. Save yourself some time.  <a href="http://t.wits.sg/misc/googleMapsHelper/demo.php">Try it!</a>
</li>
<p>Done! Whats the downside to this? <strong>You can only show the address for the business</strong>. Because searching by business names returns us way too many results. So instead, we have to search for an address, Google interprets this as an address and only returns 1 result (which is the whole point of geocoding). At this point its easy to the map to what we need. We&#8217;d use this typically for this nifty little &#8220;Find us on a map&#8221; links (instead of embedding the actual map on your site).</ul>
</li>
</ol>
<p>Once again, if you&#8217;d rather embed Google maps directly into your site via the JS, then your options are much more open.<br />
Good luck! Let us know if it works for you, of if you find a better way of doing things!<br />
<a href="http://t.wits.sg/misc/googleMapsHelper/demo.php"><img src="http://t.wits.sg/wp-content/uploads/2009/06/googleMapsHelper-300x291.png" alt="googleMapsHelper" title="googleMapsHelper" width="300" height="291" class="alignnone size-medium wp-image-314" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/14/google-maps-helper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A new look&#8230;</title>
		<link>http://t.wits.sg/2009/04/02/a-new-look/</link>
		<comments>http://t.wits.sg/2009/04/02/a-new-look/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 18:12:19 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[random babble]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=236</guid>
		<description><![CDATA[And we&#8217;ve got ourselves a new theme! The team figured that his theme really reflects our style, its business, very cartoonish, very fun, very techy, very us&#8230;. I hope you readers will like it! I think i should spend some time explaining to the readers what this site is really about. This blog is an [...]]]></description>
			<content:encoded><![CDATA[<p>And we&#8217;ve got ourselves a new theme! The team figured that his theme really reflects our style, its business, very cartoonish, very fun, very techy, very us&#8230;.<br />
I hope you readers will like it!</p>
<p>I think i should spend some time explaining to the readers what this site is really about. This blog is an outlet for our team to contribute back to the online community the tips and tricks and hair-losing answer&#8217;s we&#8217;ve spent so much of our time acquiring. We plan to have a team of writers eventually blogging about very different aspects of our work. It could be any topic that range from technology tutorials to consultancy statistics/findings to our favourite designer color palettes. So in a way, this site is meant to be touch-and-go. Come in, get your answers, get out. For those of you who will eventually be reading every single article, from business to programming to design&#8230;.. AND you happen to be looking for a challenge &#8230; AND you&#8217;d like a (new) job &#8230; perhaps you should really be contacting us for a job! <img src='http://t.wits.sg/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/04/02/a-new-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 1.2</title>
		<link>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/</link>
		<comments>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 09:58:01 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=27</guid>
		<description><![CDATA[Thanks for all the comments and feedback! By popular request i&#8217;ve added the multi-colored progress bar and fixed some bugs. The new multi-colored bar changes from red to orange and then to green at configurable intervals. Check out the demo! Since the last update this endeavour has seen comments claiming that it works and sometimes [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>Thanks for all the comments and feedback! By popular request i&#8217;ve added the multi-colored progress bar and fixed some bugs. The new multi-colored bar changes from red to orange and then to green at configurable intervals. Check out the demo!</p>
<p>Since the last update this endeavour has seen comments claiming that it works and sometimes that it doesnt. I&#8217;ve tested the demo across Safari, Opera, IE6/7, Firefox and Chrome. Havent found any problem. For those of you who have problems, please do email me the problem.</p>
<p><strong>Download the new jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a>or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>HOWTO: Readymade Form CSS and Highlighting</title>
		<link>http://t.wits.sg/2009/02/08/howto-readymade-form-css-and-highlighting/</link>
		<comments>http://t.wits.sg/2009/02/08/howto-readymade-form-css-and-highlighting/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 19:48:59 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[highlighting]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=25</guid>
		<description><![CDATA[We&#8217;ve been working on web development for awhile now, i&#8217;ve really only seen a handful of pretty forms. The interfaces seen at Uni-Form, mooflex and even to a certain extent linuxjournal are all intuitive and well thought out. So in the good ol WITS culture, we&#8217;ve tried our hand at building our own version of [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2009/02/jquerywitsform.jpg"><img class="alignleft size-medium wp-image-26" title="jquerywitsform" src="http://t.wits.sg/wp-content/uploads/2009/02/jquerywitsform.jpg" alt="jQuery WITSForm" width="200" height="200" /></a></div>
<p>We&#8217;ve been working on web development for awhile now, i&#8217;ve really only seen a handful of pretty forms. The interfaces seen at <a href="http://www.sprawsm.com/uni-form/" target="_blank">Uni-Form</a>, <a href="http://www.mooflex.net" target="_blank">mooflex</a> and even to a certain extent <a href="http://www.linuxjournal.com" target="_blank">linuxjournal</a> are all intuitive and well thought out.</p>
<p>So in the good ol WITS culture, we&#8217;ve tried our hand at building our own version of a universal form interface. Alot of features were borrowed off work already done at <a href="http://www.sprawsm.com/uni-form/" target="_blank">Uni-Form</a>. We just made it jQueried, lighter and more readable. Like all other jQuery plugins, insert jquery.js, insert the jquery.witsform.js script, insert the css, use the right html code, and you&#8217;re done! I&#8217;m pretty sure as time goes by i&#8217;ll keep improving it. So here&#8217;s version 1.0 meanwhile. We bothered so that you shouldnt have to.</p>
<p><strong>download the jQuery WITSForm here: <a href="http://t.wits.sg/downloads/jquery.witsform.1.0.zip" target="_blank">jQuery WITSForm</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryWITSForm/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/02/08/howto-readymade-form-css-and-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EXTJS themed file input field</title>
		<link>http://t.wits.sg/2008/09/01/extjs-themed-file-input-field/</link>
		<comments>http://t.wits.sg/2008/09/01/extjs-themed-file-input-field/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 16:38:14 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ext]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=18</guid>
		<description><![CDATA[Theming a file input field has always been notoriously hard. Thanks to the guys who wrote the Ext UploadDialog script, theres now a better and more aesthetically pleasing way to create a file upload. I tried using their script wholesale but ran into some problems with the layout. So i kinda hacked and extracted their [...]]]></description>
			<content:encoded><![CDATA[<p>Theming a file input field has always been notoriously hard. Thanks to the <a href="http://www.max-bazhenov.com/dev/upload-dialog-2.0/index.php" target="_blank">guys who wrote the Ext UploadDialog script</a>, theres now a better and more aesthetically pleasing way to create a file upload. I tried using their script wholesale but ran into some problems with the layout. So i kinda hacked and extracted their Ext.ux.BrowseButton code.</p>
<p>So now you can use it simply with:</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">	new Ext.ux.BrowseButton({
		input_name: &quot;uploadfile1&quot;,
		text: &quot;Select a file&quot;
		onInputFileChange: function() {
			alert(&quot;you chose &quot; + this.getInputFile().dom.value);
		}
	})
&nbsp;
	new Ext.ux.TBBrowseButton({
		input_name: &quot;uploadfile2&quot;,
		text: &quot;Select another file&quot;
	})</pre></div></div>

<p>The first chunk of code creates a Browse Button (File Input) control as with the name uploadfile1. and the second chunk of codes creates a <strong>ToolBar</strong> Browse Button with the name uploadfile2.</p>
<p>Hypothetically you should be able to add a ToolBar button but i havent quite gotten a ToolBar Browse Button to fit aesthetically well inside a form. Let me know if you all come up with any examples that do!</p>
<p>Meanwhile, 3 cheers for the <a href="http://www.max-bazhenov.com/dev/upload-dialog-2.0/index.php" target="_blank">guys who wrote the Ext UploadDialog script</a>!!!</p>
<p><strong>Download the jQuery progressbar here: <a href="http://t.wits.sg/downloads/ ext.browsebutton.1.0.zip" target="_blank">EXT Browse Button</a><br />
or view the demo <a href="http://t.wits.sg/misc/EXTBrowseButton/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/09/01/extjs-themed-file-input-field/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HOWTO: PHP and jQuery upload progress bar</title>
		<link>http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/</link>
		<comments>http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 09:09:18 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=16</guid>
		<description><![CDATA[With the controllable jQuery Progress Bar, writing a form upload progress bar seems like a piece of cake now. Hypothetically, all we need is to create the bar, poll for the progress of the file upload, derive the new progress bar value (in percentage) and set it. To do that you need to prepare the [...]]]></description>
			<content:encoded><![CDATA[<p>With the controllable jQuery Progress Bar, writing a form upload progress bar seems like a piece of cake now. Hypothetically, all we need is to create the bar, poll for the progress of the file upload, derive the new progress bar value (in percentage) and set it.</p>
<p>To do that you need to prepare the php script to do it. By default PHP cant report the progress of upload progress. However people smarter than me have already solved that problem. In 5 mins i&#8217;ve found 2 solutions: the <a href="http://pecl.php.net/apc" target="_blank">Alternative PHP Cache (APC)</a> method as well as the <a href="http://pecl.php.net/package/uploadprogress" target="_blank">UploadProgress </a>method. Both of them are PECL packages. Because i couldnt get APC to work on my server properly, i&#8217;ll document the UploadProgress more in detail here&#8230;</p>
<div class="contenblock"><strong>Step 1: Install the uploadprogress package. </strong>Really simple just run the following command  </p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">pecl install uploadprogress</pre></div></div>

<p>Once that is done, register the extension to your PHP with the following line in your php.ini</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">extension=uploadprogress.so</pre></div></div>

<p>then restart your apache/httpd</p>
</div>
<div class="contentblock"><strong>Step 2: Create the form and your progress bar</strong>  </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>form id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;uploadform&quot;</span> enctype<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;multipart/form-data&quot;</span> method<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;progress_key&quot;</span> <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;UPLOAD_IDENTIFIER&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;hidden&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&amp;lt;?= $uuid ?&amp;gt;&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ulfile&quot;</span> <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ulfile&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;file&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Upload&quot;</span> <span style="color: #339933;">/&gt;</span>
	<span style="color: #339933;">&lt;</span>span id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;uploadprogressbar&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;progressbar&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">%&lt;/</span>span<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span></pre></div></div>

<p>this creates the form with a file field as well as a unique UPLOAD_IDENTIFIER hidden field that allows our script to check the progress of the form submission.</p>
</div>
<div class="contentblock"><strong>Step 3: Next the script itself to check the respond with the progress of the form submission.</strong> Lets call this file <em>uploadprogress.php</em>  </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: no-cache, must-revalidate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span>uploadprogress_get_info<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The header no-cache declarations circumvents IE&#8217;s cache of the response. Basically this form does nothing but respond with a json encoded string of the uploadprogress_get_info function. The id argument is the same one we used in the form. Think of it as a form-upload-process-id. A typical response looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;time_start&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;1214384364&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;time_last&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;1214384366&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;speed_average&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;25889&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;speed_last&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;40952&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;bytes_uploaded&quot;</span> <span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;51778&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;bytes_total&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;8125518&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;files_uploaded&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;est_sec&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;311&quot;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>the response encodes a good deal of data about the form submission. most importantly for us: <em>bytes_uploaded</em> and <em>bytes_total</em></p>
</div>
<div class="contentblock"><strong>Step 3: use jQuery and a timer to keep polling the page and update the progress bar value</strong>  </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> progress_key <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// this sets up the progress bar</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#uploadprogressbar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">progressBar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// fades in the progress bar and starts polling the upload progress after 1.5seconds</span>
<span style="color: #003366; font-weight: bold;">function</span> beginUpload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#uploadprogressbar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;showUpload()&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1500</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// uses ajax to poll the uploadprogress.php page with the id</span>
<span style="color: #006600; font-style: italic;">// deserializes the json string, and computes the percentage (integer)</span>
<span style="color: #006600; font-style: italic;">// update the jQuery progress bar</span>
<span style="color: #006600; font-style: italic;">// sets a timer for the next poll in 750ms</span>
<span style="color: #003366; font-weight: bold;">function</span> showUpload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;uploadprogress.php?id=&quot;</span> <span style="color: #339933;">+</span> progress_key<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>data<span style="color: #009900;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> response<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">eval</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;response = &quot;</span> <span style="color: #339933;">+</span> data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>response<span style="color: #009900;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> percentage <span style="color: #339933;">=</span> Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">100</span> <span style="color: #339933;">*</span> parseInt<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'bytes_uploaded'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> parseInt<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'bytes_total'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#uploadprogressbar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">progressBar</span><span style="color: #009900;">&#40;</span>percentage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;showUpload()&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">750</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>viola! read the comments if you dont understand the code. it is _THAT_ straightforward. Of course there can be many improvements such as stopping the script when the upload reaches 100% but thats probably not really needed since the whole page is refreshed. But this approach allows the flexibility of ajax submissions and what nots.</p>
<p><strong>Again, download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
</div>
<div class="contentblock" style="padding-top: 15px; border-top: 1px dashed #ddd;"><strong>Note:</strong> for the APC solution seekers out there, assuming you can get APC to work, the solution is not so different. A few changes will get your there:  </p>
<ul>
<li>Change the HTML hidden form field name from <em>UPLOAD_IDENTIFIER</em> to <em>APC_UPLOAD_PROGRESS</em></li>
<li>Change the PHP <em>uploadprogress_get_info($_GET['id'])</em> to <em>apc_fetch(&#8216;upload_&#8217;.$_GET['id']));</em></li>
<li>Change the Javascript percentage calculation from:<br />
<em>Math.floor(100 * parseInt(response['bytes_uploaded']) / parseInt(response['bytes_total']));</em><br />
to:<br />
<em>Math.floor(100 * parseInt(response['current']) / parseInt(response['total']));</em></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 1.1</title>
		<link>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/</link>
		<comments>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 11:42:04 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=14</guid>
		<description><![CDATA[This code has been downloaded quite abit so i thought i&#8217;d put in some effort to improve it. I found some free time this evening to clean up the code. The original code is a couple of months old and its my first jquery plugin. I didnt quite understand what i was doing then.I made [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>This code has been downloaded quite abit so i thought i&#8217;d put in some effort to improve it. I found some free time this evening to clean up the code. The original code is a couple of months old and its my first jquery plugin. I didnt quite understand what i was doing then.I made the code less resource intensive and more configurable.</p>
<p>The progress bar can now be controlled externally. click on the demo link below to see what i&#8217;m talking about. I&#8217;ll know of at least 1 bug in the script if its fully tested, will try to fix this within the week. Meanwhile if you have any ideas for improvements, please leave a comment!</p>
<p><strong><br />
Download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
	</channel>
</rss>
