<?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>getButterfly - WordPress Plugins</title>
	<atom:link href="http://getbutterfly.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://getbutterfly.com</link>
	<description>WordPress Plugins and Themes</description>
	<lastBuildDate>Thu, 17 May 2012 17:30:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Nice Date Feature Part 2 &#8211; Fuzzy Timestamps</title>
		<link>http://getbutterfly.com/nice-date-feature-part-2-fuzzy-timestamps/</link>
		<comments>http://getbutterfly.com/nice-date-feature-part-2-fuzzy-timestamps/#comments</comments>
		<pubDate>Tue, 15 May 2012 07:44:27 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[fuzzy]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3623</guid>
		<description><![CDATA[A while ago I wrote about the &#8220;nice date&#8221; feature for PHP dates, (e.g. &#8220;4 minutes ago&#8221; or &#8220;about 1 day ago&#8221;). Read the old post here - http://getbutterfly.com/nice-date-feature-facebook-style/. A jQuery alternative to this date is a plugin called timeago, which automatically converts any standard PHP date into a fuzzy timestamp. http://timeago.yarp.com/ https://github.com/rmm5t/jquery-timeago Avoid timestamps dated &#8220;1 [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-3624 colorbox-3623" title="timeago" src="http://getbutterfly.com/wp-content/uploads/2012/05/timeago.jpg" alt="timeago" width="630" height="150" /></p>
<p>A while ago I wrote about the &#8220;nice date&#8221; feature for PHP dates, (e.g. &#8220;4 minutes ago&#8221; or &#8220;about 1 day ago&#8221;). Read the old post here - <a href="http://getbutterfly.com/nice-date-feature-facebook-style/">http://getbutterfly.com/nice-date-feature-facebook-style/</a>.</p>
<p>A jQuery alternative to this date is a plugin called <strong>timeago</strong>, which automatically converts any standard PHP date into a fuzzy timestamp.</p>
<ul>
<li><a href="http://timeago.yarp.com/">http://timeago.yarp.com/</a></li>
<li><a href="https://github.com/rmm5t/jquery-timeago">https://github.com/rmm5t/jquery-timeago</a></li>
</ul>
<p>Avoid timestamps dated &#8220;1 minute ago&#8221; even though the page was opened 10 minutes ago;<em>timeago refreshes automatically</em>.</p>
<p>You can <em>take full advantage of page caching</em> in your web applications, because the timestamps aren&#8217;t calculated on the server.</p>
<p>You get to <em>use <a href="http://microformats.org/wiki/datetime-design-pattern">microformats</a></em> like the cool kids.</p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/nice-date-feature-part-2-fuzzy-timestamps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Penguin Update</title>
		<link>http://getbutterfly.com/the-penguin-update/</link>
		<comments>http://getbutterfly.com/the-penguin-update/#comments</comments>
		<pubDate>Mon, 14 May 2012 08:39:03 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[penguin]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3621</guid>
		<description><![CDATA[Even if you&#8217;re not buying links, you can still get affected by the Penguin Update. This isn&#8217;t an update about whether you are buying links or not buying links. This an update about how you&#8217;re trying to manipulate Google. That&#8217;s the whole idea of Penguin Update. The intended function is to penalize sites that: Engage [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-3622 colorbox-3621" title="Penguins" src="http://getbutterfly.com/wp-content/uploads/2012/05/penguins.jpg" alt="Penguins" width="630" height="150" /></p>
<p>Even if you&#8217;re not buying links, you can still get affected by the Penguin Update. This isn&#8217;t an update about whether you are buying links or not buying links. This an update about how you&#8217;re trying to manipulate Google.</p>
<p>That&#8217;s the whole idea of Penguin Update.</p>
<p><iframe width="630" height="354" src="http://www.youtube.com/embed/Wq7ofr7NRZQ?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>The intended function is to penalize sites that:</p>
<ul>
<li>Engage in &#8220;keyword stuffing&#8221;</li>
<li>Participate in &#8220;link schemes&#8221;</li>
<li>And are generally of low quality</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/the-penguin-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Share Button</title>
		<link>http://getbutterfly.com/google-share-button/</link>
		<comments>http://getbutterfly.com/google-share-button/#comments</comments>
		<pubDate>Mon, 14 May 2012 07:58:10 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[like]]></category>
		<category><![CDATA[share]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3618</guid>
		<description><![CDATA[It&#8217;s been a while since Google launched Google+ and the accompanying Share button was nowhere to be seen. A similar function was handled by the +1 button, but it felt like something was missing. Every other social network had at least 2 (two) buttons for liking or recommending or sharing links. It&#8217;s now time for [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since Google launched Google+ and the accompanying Share button was nowhere to be seen. A similar function was handled by the +1 button, but it felt like something was missing. Every other social network had at least 2 (two) buttons for liking or recommending or sharing links.</p>
<p>It&#8217;s now time for Google to get into the game with its own Share button.</p>
<p><a href="https://developers.google.com/+/plugins/share/">https://developers.google.com/+/plugins/share/</a></p>
<p><img class="alignnone size-full wp-image-3619 colorbox-3618" title="Google Share Button" src="http://getbutterfly.com/wp-content/uploads/2012/05/google-share.png" alt="Google Share Button" width="630" height="100" /></p>
<p>I&#8217;ve yet to use it on my sites and blogs but it seems to complement the +1 button pretty nicely. There&#8217;s no need for me to +1 a link, then hover the mouse again to open the sharing popup.</p>
<div class="g-plus" data-action="share" data-href="http://getbutterfly.com"></div>
<p><script type="text/javascript">// < ![CDATA[
    (function() {     var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;     po.src = 'https://apis.google.com/js/plusone.js';     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);   })();
// ]]&gt;</script></p>
<p>Try clicking on the button above to see how it works. It will not do any harm, just share my page.</p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/google-share-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPCandy Quarterly Magazine</title>
		<link>http://getbutterfly.com/wpcandy-quarterly-magazine/</link>
		<comments>http://getbutterfly.com/wpcandy-quarterly-magazine/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 16:59:53 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[quarterly]]></category>
		<category><![CDATA[wpcandy]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3606</guid>
		<description><![CDATA[I&#8217;ve just received my shipping confirmation for WPCandy Quarterly. I&#8217;ve been intrigued by some of the featured authors, and decided to purchase it. It&#8217;s not a PDF, it&#8217;s an actual paper magazine. Yes, paper! &#8220;In the very first issue of The WPCandy Quarterly, a dozen contributors bring articles covering each corner of the WordPress community. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://getbutterfly.com/wp-content/uploads/2012/04/q-cover-issue01-300x387.jpg"><img class="alignright size-medium wp-image-3607 colorbox-3606" title="q-cover-issue01-300x387" src="http://getbutterfly.com/wp-content/uploads/2012/04/q-cover-issue01-300x387-186x240.jpg" alt="" width="186" height="240" /></a>I&#8217;ve just received my shipping confirmation for WPCandy Quarterly. I&#8217;ve been intrigued by some of the featured authors, and decided to purchase it. It&#8217;s not a PDF, it&#8217;s an actual paper magazine. Yes, paper!</p>
<p><em>&#8220;In the very first issue of The WPCandy Quarterly, a dozen contributors bring articles covering each corner of the WordPress community. This issue includes exclusive articles from Justin Tadlock, Chip Bennett, Ben Gillbanks, Ben Balter, and many others.&#8221;</em></p>
<p>Shouldn&#8217;t be more than 2 weeks to arrive in my mail box!</p>
<p><a href="http://wpcandy.com/quarterly">http://wpcandy.com/quarterly</a></p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/wpcandy-quarterly-magazine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check Your WordPress Installation For Malware</title>
		<link>http://getbutterfly.com/check-your-wordpress-installation-for-malware/</link>
		<comments>http://getbutterfly.com/check-your-wordpress-installation-for-malware/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 16:15:06 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[scan]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3594</guid>
		<description><![CDATA[I&#8217;ve recently been hit by several injection attacks to some of my clients&#8217; WordPress based sites. Some theme and plugin files were injected with an eval() function containing hidden IFRAMEs and redirections. While some antivirus and scanning plugins detected parts of this infection, I&#8217;ve had 100% luck with 2 direct file scanners. Placed in my [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-3601 colorbox-3594" title="WordPress Malware" src="http://getbutterfly.com/wp-content/uploads/2012/04/wordpress-malware.jpg" alt="WordPress Malware" width="630" height="100" /></p>
<p>I&#8217;ve recently been hit by several injection attacks to some of my clients&#8217; WordPress based sites. Some theme and plugin files were injected with an <strong>eval()</strong> function containing hidden IFRAMEs and redirections.</p>
<p>While some antivirus and scanning plugins detected parts of this infection, I&#8217;ve had 100% luck with 2 direct file scanners. Placed in my WordPress site root and directly accessed, the scripts listed all files injected with the dreaded <strong>eval()</strong> function.</p>
<p>Each of these files does the same thing, in different ways. Test them both.</p>
<ul>
<li><a href="http://getbutterfly.com/wp-content/uploads/2012/04/chipScan.zip">chipScan</a></li>
<li><a href="http://getbutterfly.com/wp-content/uploads/2012/04/chipWare.zip">chipWare</a></li>
</ul>
<p><a href="http://getbutterfly.com/wp-content/uploads/2012/04/wordpress-root.png"><img class="alignright size-thumbnail wp-image-3604 colorbox-3594" title="WordPress - FTP root" src="http://getbutterfly.com/wp-content/uploads/2012/04/wordpress-root-150x150.png" alt="WordPress - FTP root" width="150" height="150" /></a><strong>How to use</strong></p>
<p>Place the .php files inside your WordPress root (i.e. where index.php is). Run them using <em>yourdomain.com<strong>/chipScan.php</strong></em> or <em>yourdomain.com<strong>/chipWare.php</strong></em>. The scripts will display all files containing injected code. Open each of your infected files and remove the <strong>eval()</strong> code.</p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/check-your-wordpress-installation-for-malware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: CSS Multiple Borders</title>
		<link>http://getbutterfly.com/quick-tip-css-multiple-borders/</link>
		<comments>http://getbutterfly.com/quick-tip-css-multiple-borders/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 09:18:02 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[border]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[multiple]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3585</guid>
		<description><![CDATA[Here&#8217;s a simple way to apply multiple borders to a paragraph, section or a block element. .mydiv { border: 10px solid #F8F8F8; outline: 1px dashed #e4e4e4; } By multiple you should understand two borders, which is enough for most cases, and I&#8217;m sure this tip will help lots of users. The outline element won&#8217;t work [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-3595 alignnone colorbox-3585" title="CSS Multiple Borders" src="http://getbutterfly.com/wp-content/uploads/2012/03/css-multiple-borders.jpg" alt="CSS Multiple Borders" width="630" height="200" /></p>
<p>Here&#8217;s a simple way to apply multiple borders to a paragraph, section or a block element.</p>
<pre>.mydiv {
    border: 10px solid #F8F8F8;
    outline: 1px dashed #e4e4e4;
}</pre>
<p>By multiple you should understand two borders, which is enough for most cases, and I&#8217;m sure this tip will help lots of users.</p>
<p>The <strong>outline</strong> element won&#8217;t work in IE6/7, but I don&#8217;t really care, as IE6 has been discontinued, and IE7 will be discontinued.</p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/quick-tip-css-multiple-borders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gbPlayer5 and HTML5 Video</title>
		<link>http://getbutterfly.com/gbplayer5-and-html5-video/</link>
		<comments>http://getbutterfly.com/gbplayer5-and-html5-video/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 10:29:38 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3590</guid>
		<description><![CDATA[What is HTML5 Video? HTML is the markup language that makes up every page on the web. The newest version, HTML5, includes specifications for a &#60;video&#62; tag, that’s meant to allow web developers to add a video to a page in the same way they would add an image. In order for this to work, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is HTML5 Video?</strong></p>
<p><img class="alignright size-full wp-image-3592 colorbox-3590" title="gbPlayer5" src="http://getbutterfly.com/wp-content/uploads/2012/03/thumbnail.jpg" alt="gbPlayer5" width="80" height="80" />HTML is the markup language that makes up every page on the web. The newest version, HTML5, includes specifications for a &lt;video&gt; tag, that’s meant to allow web developers to add a video to a page in the same way they would add an image. In order for this to work, web browser developers have built video playback functionality into their browsers.</p>
<p>Playing video in a web page may not seem so special since you can already view video on a web page through plugins like Flash Player, Quicktime, and Silverlight. However, this is actually a big step forward for standardizing video playback across web browsers and devices. The goal is that in the future, developers will only need to use one method for embedding a video, based on open standards (not controlled by one company), and it will work everywhere. Additionally, HTML5 video can improve video performance by not requiring a second application (a plugin) to be running, and opens the door to creating interactions between video and other elements on the page that hasn’t been possible before.</p>
<p><strong>What is an HTML5 Video Player?</strong></p>
<p>An HTML5 Video Player is a JavaScript library that builds a custom set of controls over top of the HTML5 video element using jQuery in order to provide a consistent look between HTML5 browsers. gbPlayer5 is HTML5 compliant and uses the latest version of jQuery available from googleapis.com library.</p>
<p><img class="alignnone size-full wp-image-3591 colorbox-3590" title="gbPlayer5 - HTML5 video player" src="http://getbutterfly.com/wp-content/uploads/2012/03/gbplayer5-html5-video-player-preview.jpg" alt="gbPlayer5 - HTML5 video player" width="630" height="300" /></p>
<p><strong>gbPlayer5</strong> is a JavaScript plugin for jQuery that makes it easier to work with and build on<strong>HTML5 video</strong>, today. This is also known as an “<strong>HTML5 Video Player</strong>“. <strong>gbPlayer5</strong> provides a common controls skin built in HTML/CSS, cross-browser compatibility, and adds additional features like browser/real fullscreen.</p>
<p><strong>gbPlayer5</strong> is free and can be downloaded from here:</p>
<ul>
<li><a href="http://getbutterfly.com/products/gbplayer5/">http://getbutterfly.com/products/gbplayer5/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/gbplayer5-and-html5-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading Time Affects Your Rankings &#8211; Top 10 Reasons</title>
		<link>http://getbutterfly.com/loading-time-affects-your-rankings-top-10-reasons/</link>
		<comments>http://getbutterfly.com/loading-time-affects-your-rankings-top-10-reasons/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 12:56:11 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[SEO and Industry News]]></category>
		<category><![CDATA[loading]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3577</guid>
		<description><![CDATA[Loading time affects your bottom line. And your CTR. And your conversions. And your pocket. Every second counts Loading time is a major contributing factor to page abandonment. Or bounce rate. The average user has no patience for a page that takes too long to load, and justifiably so. Observation: slower page response time results [...]]]></description>
			<content:encoded><![CDATA[<p>Loading time affects your bottom line. And your CTR. And your conversions. And your pocket.</p>
<p><strong>Every second counts</strong></p>
<p>Loading time is a major contributing factor to page abandonment. Or bounce rate. The average user has no patience for a page that takes too long to load, and justifiably so.</p>
<p>Observation: slower page response time results in an increase in page abandonment. If a page takes more than 4 seconds to load, the bounce rate doubles exponentially.</p>
<p><img class="alignnone size-full wp-image-3586 colorbox-3577" title="Loading time" src="http://getbutterfly.com/wp-content/uploads/2012/03/loading-time.jpg" alt="Loading time" width="630" height="252" /></p>
<p><strong>Website performance affects shopping behaviour</strong></p>
<ul>
<li>47% of consumers expect a web page to load in 2 seconds or less.</li>
<li>40% abandon a website that takes more than 3 seconds to load.</li>
<li>79% of shoppers who are dissatisfied with website performance are less likely to buy from the same site again.</li>
<li>52% of online shoppers state that quick page loading is important to their site loyalty.</li>
<li>A 1 second delay (or 3 seconds of waiting) decreases customer satisfaction by about 16%.</li>
<li>44% of online shoppers will tell their friends about a bad experience online.</li>
</ul>
<p><strong>Mobile vs. desktop</strong></p>
<p>Mobile Internet users expect a web-browsing experience on their phone that’s comparable to what they get on their desktop or laptop. Most users are aware that their phone had slower load times than their desktop. And this without a responsive web site design.</p>
<p><strong>Bottom line</strong></p>
<p>A 1 second delay in page response can result in a 7% reduction in conversions.</p>
<p>If an e-commerce site is making $100,000 per day, a 1 second page delay could potentially cost you $2.5 million in lost sales every year.</p>
<p>According to <a href="http://loads.in/">loads.in</a>, getbutterfly.com loads in 6.9 seconds, with CloudFlare activated (this means it needs a bit more optimization), diamante.ro loads in 3.2 seconds, on a local VPS, and maschio-shop.ro in 7.4 seconds (lots of custom fonts from Google &#8211; time to say goodbye). Also, time to make some optimizations.</p>
<p><small><em>Courtesy of <a href="http://www.kissmetrics.com" target="_blank">kissmetrics.com</a></em></small></p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/loading-time-affects-your-rankings-top-10-reasons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Giant Logos</title>
		<link>http://getbutterfly.com/moving-giant-logos/</link>
		<comments>http://getbutterfly.com/moving-giant-logos/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 17:29:03 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[giant]]></category>
		<category><![CDATA[logo]]></category>
		<category><![CDATA[moving]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3580</guid>
		<description><![CDATA[A client logo I&#8217;m working on. It&#8217;s the pitching version. UPDATE: The logo underwent some changes, and it&#8217;s now final using a combination of green and orange. The background map was created manually by aligning tiny circles and combining them into a large shape.]]></description>
			<content:encoded><![CDATA[<p>A client logo I&#8217;m working on. It&#8217;s the pitching version.</p>
<p><a href="http://getbutterfly.com/wp-content/uploads/2012/03/moving-giant-logo-01.png"><img class="alignnone size-medium wp-image-3581 colorbox-3580" title="moving-giant-logo-01" src="http://getbutterfly.com/wp-content/uploads/2012/03/moving-giant-logo-01-300x225.png" alt="" width="300" height="225" /></a></p>
<p><strong>UPDATE:</strong> The logo underwent some changes, and it&#8217;s now final using a combination of green and orange. The background map was created manually by aligning tiny circles and combining them into a large shape.</p>
<p><img class="alignnone size-full wp-image-3597 colorbox-3580" title="Moving Giant - transparent stationery logo" src="http://getbutterfly.com/wp-content/uploads/2012/03/moving-giant-transparent-stationery-color.jpg" alt="Moving Giant - transparent stationery logo" width="630" height="302" /></p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/moving-giant-logos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to declare a global variable inside a jQuery function</title>
		<link>http://getbutterfly.com/how-to-declare-a-global-variable-inside-a-jquery-function/</link>
		<comments>http://getbutterfly.com/how-to-declare-a-global-variable-inside-a-jquery-function/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 16:53:37 +0000</pubDate>
		<dc:creator>Ciprian</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://getbutterfly.com/?p=3572</guid>
		<description><![CDATA[This article deals with a problem I used to bang my head about the other day. I needed to declare a global variable inside a jQuery function (it works with regular JavaScript, too), and read it inside another function. If the first function isn&#8217;t called/initiated, the second function doesn&#8217;t know the value of the global [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://getbutterfly.com/wp-content/uploads/2012/03/javascript-global-variable.jpg"><img class="alignright size-medium wp-image-3578 colorbox-3572" title="JavaScript global variable" src="http://getbutterfly.com/wp-content/uploads/2012/03/javascript-global-variable-300x225.jpg" alt="JavaScript global variable" width="300" height="225" /></a>This article deals with a problem I used to bang my head about the other day.</p>
<p>I needed to declare a global variable inside a jQuery function (it works with regular JavaScript, too), and read it inside another function. If the first function isn&#8217;t called/initiated, the second function doesn&#8217;t know the value of the global variable.</p>
<p>For example, this function sets the sort order of a column of a table, nothing really interesting:</p>
<pre>function clickMe(sortOrder) {

sortOrderNew = sortOrder;

}</pre>
<p>When the function is executed, a global JavaScript variable is set. Notice there is no <strong>var</strong> in the declaration.</p>
<p>This line:</p>
<pre>var sortOrderNew = sortOrder;</pre>
<p>would set a local variable inside the said function.</p>
<p>Now, a second function needs this global variable. If it is set, it will automatically pick it up, if not, it will set a local variable with a fallback value:</p>
<pre>function chipPaginate(page) {

if(typeof sortOrderNew == 'undefined') var sortOrder = 3;

if(typeof sortOrderNew != 'undefined') var sortOrder = sortOrderNew;

alert(sortOrder);

}</pre>
<p>Notice I&#8217;m doing some checks to see if <strong>sortOrderNew</strong> is defined. If not, it will assign it the value of 3 (it makes sense inside my function). Again, notice I&#8217;m using <strong>var</strong> in front of my variables, to set them locally.</p>
<p><strong>Conclusion:</strong></p>
<pre>if(typeof myVariable == 'undefined')</pre>
<p>checks if <strong>myVariable</strong> is defined or not.</p>
<pre><del>var</del> myVariable = 5;</pre>
<p>ommiting <strong>var</strong> will make <strong>myVariable</strong> global (i.e. readable among functions)</p>
]]></content:encoded>
			<wfw:commentRss>http://getbutterfly.com/how-to-declare-a-global-variable-inside-a-jquery-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

