<?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>Pedro Proença &#187; bar</title>
	<atom:link href="http://pedroproenca.info/tag/bar/feed" rel="self" type="application/rss+xml" />
	<link>http://pedroproenca.info</link>
	<description>delphi, php, mysql, css, html</description>
	<lastBuildDate>Tue, 15 Dec 2009 21:01:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating a Simple Progress-bar</title>
		<link>http://pedroproenca.info/creating-a-simple-progress-bar</link>
		<comments>http://pedroproenca.info/creating-a-simple-progress-bar#comments</comments>
		<pubDate>Sat, 21 Nov 2009 00:20:17 +0000</pubDate>
		<dc:creator>Pedro</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[bar]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://pedroproenca.info/?p=44</guid>
		<description><![CDATA[As you can see, in the homepage, I added a small bar which shows the current progress of my projects, I though of coding a plug-in and make it available to everyone but using a PHP function is much more simple ! 
Maybe, when I no longer have projects which need my attention, I might [...]]]></description>
			<content:encoded><![CDATA[<p>As you can see, in the homepage, I added a small bar which shows the current progress of my projects, I though of coding a plug-in and make it available to everyone but using a <a title="PHP " href="http://en.wikipedia.org/wiki/PHP">PHP </a>function is much more simple ! <img src='http://pedroproenca.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Maybe, when I no longer have projects which need my attention, I might waste sometime coding the plug-in version.</p>
<p>In this tutorial I&#8217;ll guide you through the simple process that is to create a progress-bar, using <a title="PHP" href="http://en.wikipedia.org/wiki/PHP">PHP</a> combined with <a title="HTML" href="http://en.wikipedia.org/wiki/HTML">HTML</a> (and some <a title="CSS" href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">CSS</a>).</p>
<p><span id="more-44"></span></p>
<h2>For WordPress Users</h2>
<p><strong>1. Download the necessary plug-in</strong></p>
<p>First of all you need a plug-in which allows to use <a title="PHP" href="http://en.wikipedia.org/wiki/PHP">PHP</a> code on a widget, the best is the one shown below:</p>
<p><strong>Name:</strong> <a title="PHP" href="http://en.wikipedia.org/wiki/PHP">PHP</a> Widget<br />
<strong>Download:</strong> <a href="http://wordpress.org/extend/plugins/php-code-widget/" target="_blank">http://wordpress.org/extend/plugins/php-code-widget/</a></p>
<p><strong>2. The CSS</strong></p>
<p style="padding-left: 30px;">Follow the steps in the image:</p>
<p style="padding-left: 30px;">(In step two you must scroll-down a little to find the &#8220;Styles&#8221; group.)</p>
<p><a href="http://pedroproenca.info/wp-content/uploads/2009/11/steps.png"><img class="alignnone size-full wp-image-45" style="border: 0pt none;" title="Changing CSS Steps" src="http://pedroproenca.info/wp-content/uploads/2009/11/steps.png" alt="Changing CSS Steps" width="389" height="167" /></a></p>
<p>After click the &#8220;Stylesheet (style.css)&#8221; link, you should see a big white box, just add at the bottom of it the following code:</p>
<pre class="brush:css">/* warps the whole progress-bar */
.progress_contain_phpBar{
	background-color: #dbd4ba;
	padding: 5px;
	padding-bottom: 2px;
	padding-top: 2px;
}
/* it's the progress-bar background */
.progress_back_phpBar{
	background-color:#9a8e76;
	border:thin #999;
	height:15px;
	padding:0px;
	margin-bottom:10px;
}
/* here it is our poor bar */
.progress_phpBar{
	position:inherit;
	background-color:#534d3e;
	height:100%;
	margin:0px;
}</pre>
<p>Save it.</p>
<p><strong>3. The PHP</strong></p>
<p>Now that we finally added our <a title="CSS" href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">CSS</a> code we can finally add the code which will make the machine work:</p>
<p>Copy the code below into a new TEXT file and save it as &#8220;progbar.php&#8221;</p>
<pre class="brush:php">function CreateBar($total, $done, $width, $project) {
/* Calculates the progress, La Place Probability Theory */
$progress = ($done / $total) * $width;
/* Let's do a nice lookin title */
$title = '&lt;strong&gt;' . $project . '&lt;/strong&gt; progress: &lt;strong&gt;' . (($done / $total) * 100) . '%&lt;/strong&gt;';
$html .= ' &lt;div&gt;';
/* Outputs the title */
$html .= $title;
/* Forces the bar to use the given width value */
 $html .= ' &lt;div&gt;';
$html .= ' &lt;div&gt;';
$html .= '&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ';
echo $html;
}</pre>
<p><strong>$total</strong> -&gt; Max Progress<br />
<strong>$done</strong> -&gt; Progress so far<br />
<strong>$width</strong> -&gt; Progress-bar width (insert only integer values, no &#8216;px&#8217; or &#8216;%&#8217;, etc)<br />
<strong>$project</strong> -&gt; Name of the project which will appear in the title</p>
<p>After creating the file, access your website FTP, create a new directory in the main folder called &#8220;extras&#8221; and then put the &#8220;progbar.php&#8221; inside it.</p>
<p>Now go to your WordPress administration panel and where it says &#8220;Widgets&#8221; on the &#8220;Appearance&#8221; tab, click it and you should see a widget called &#8220;PHP code&#8221;</p>
<p style="padding-left: 30px;"><a href="http://pedroproenca.info/wp-content/uploads/2009/11/phpbar.jpg"><img class="alignnone size-full wp-image-51" style="border: 0pt none;" title="Widgets PHP code" src="http://pedroproenca.info/wp-content/uploads/2009/11/phpbar.jpg" alt="Widgets PHP code" width="461" height="369" /></a></p>
<p>Drag this widget to the bars on the right and then enter the following info:</p>
<p style="padding-left: 30px;"><a href="http://pedroproenca.info/wp-content/uploads/2009/11/projectsprogress.jpg"><img class="alignnone size-full wp-image-52" style="border: 0pt none;" title="Projects Progress Image" src="http://pedroproenca.info/wp-content/uploads/2009/11/projectsprogress.jpg" alt="Projects Progress Image" width="416" height="458" /></a></p>
<p><strong>CreateBar(<span style="color: #ff9900;"> <em>Total Progress</em></span></strong>, <span style="color: #339966;"><strong><em>Done so far</em></strong></span>, <span style="color: #0000ff;"><strong><em>Progress-bar Width</em></strong></span>, <strong><span style="color: #808080;"><em>Project Name</em></span>)</strong></p>
<p>Hit save and voila! It&#8217;s done!</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d44').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d44" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://buzz.yahoo.com/submit?submitUrl=http://pedroproenca.info/creating-a-simple-progress-bar&amp;submitHeadline=Creating+a+Simple+Progress-bar&amp;submitSummary=" rel="nofollow" title="Add to&nbsp;Buzz"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/buzz.png" title="Add to&nbsp;Buzz" alt="Add to&nbsp;Buzz" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://pedroproenca.info/creating-a-simple-progress-bar&amp;title=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://pedroproenca.info/creating-a-simple-progress-bar&amp;title=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://pedroproenca.info/creating-a-simple-progress-bar" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://pedroproenca.info/creating-a-simple-progress-bar&amp;title=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://pedroproenca.info/creating-a-simple-progress-bar&amp;bm_description=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http://pedroproenca.info/creating-a-simple-progress-bar&amp;T=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://pedroproenca.info/creating-a-simple-progress-bar&amp;title=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://pedroproenca.info/creating-a-simple-progress-bar&amp;title=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://pedroproenca.info/creating-a-simple-progress-bar" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://tipd.com/submit.php?url=http://pedroproenca.info/creating-a-simple-progress-bar" rel="nofollow" title="Add to&nbsp;Tip'd"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/tipd.png" title="Add to&nbsp;Tip'd" alt="Add to&nbsp;Tip'd" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Creating+a+Simple+Progress-bar+@+http://pedroproenca.info/creating-a-simple-progress-bar" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://pedroproenca.info/creating-a-simple-progress-bar&amp;t=Creating+a+Simple+Progress-bar" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://pedroproenca.info/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d44').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
<script type="text/javascript">$$('div.d44').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); </script>]]></content:encoded>
			<wfw:commentRss>http://pedroproenca.info/creating-a-simple-progress-bar/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
