<?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>Hostetter Designs &#187; Blog</title>
	<atom:link href="http://www.hostetterdesigns.com/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hostetterdesigns.com</link>
	<description>Innovative Ideas</description>
	<lastBuildDate>Sun, 26 Jun 2011 08:37:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby for Newbies: The Tilt Gem</title>
		<link>http://feedproxy.google.com/~r/nettuts/~3/w1uI2OVsepk/</link>
		<comments>http://feedproxy.google.com/~r/nettuts/~3/w1uI2OVsepk/#comments</comments>
		<pubDate>Thu, 12 May 2011 18:34:21 +0000</pubDate>
		<dc:creator>Andrew Burgess</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=20027</guid>
		<description><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=20027&#038;c=1574921182' target='_blank'><img src='http://rss.buysellads.com/img.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=20027&#038;c=1574921182' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' target='_blank'>Advertise here</a></p><p>Ruby is a one of the most popular languages used on the web. We&#8217;ve started a new <a href='http://net.tutsplus.com/sessions/ruby-for-newbies/'>Session</a> here on Nettuts+ that will introduce you to Ruby, as well as the great frameworks and tools that go along with Ruby development. In this episode, we&#8217;ll be looking at <a href="https://rubygems.org/gems/tilt">Tilt</a>, an all-inclusive wrapper gem for Ruby template engines.</p>
<p><span id="more-20027"></span></p>
<hr />
<h2>Video Tutorial</h2>
<div class="tutorial_image">
<iframe src="http://blip.tv/play/gcMVgrrNTQA.html" width="600" height="338" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#gcMVgrrNTQA" style="display:none"></embed></p>
<div>Subscribe to our <a href="http://youtube.com/nettutsplus">YouTube</a> and <a href="http://http://nettuts.blip.tv/">Blip.tv</a> channels to watch more screencasts. </div>
</div>
<hr />
<h2>Rendering Templates</h2>
<p>If you&#8217;ve used a Ruby web framework&#8212;like Rails and Sinatra&#8212;you&#8217;re probably familiar with at least one of the many template engines available: I&#8217;m about about options like ERB or Haml. When using them in the context of a framework, it&#8217;s pretty simple &#8230; but sometimes they seem very embedded; what if you want to use them in your own project? Is there an easy way to harness their usefulness?</p>
<p>Enter the <a href='https://github.com/rtomayko/tilt/'>Tilt gem</a>. Billed as a &#8220;thin interface over a bunch of different Ruby template engines,&#8221; you&#8217;ll find it makes rendering templates a breeze.</p>
<p>Of course, we&#8217;ll install it first.</p>
<pre class="ruby" name="code">gem install tilt</pre>
<p>If you&#8217;re not using RVM (<a href='http://net.tutsplus.com/tutorials/why-you-should-use-rvm/'>which you should be</a>), you might have to run that with root privileges (<code>sudo</code>).</p>
<p>Of course, you&#8217;ll need to start with a template to render. We&#8217;ll keep it simple:</p>
<pre class="html" name="code">&#60;!DOCTYPE html&#62;
&#60;html lang=&#34;en&#34;&#62;
&#60;head&#62;
    &#60;meta charset=&#34;UTF-8&#34; /&#62;
    &#60;title&#62;&#60;%= title %&#62;&#60;/title&#62;
&#60;/head&#62;
&#60;body&#62;
    &#60;h2&#62;A few of the Tuts+ Sites&#60;/h2&#62;
    &#60;ul&#62;
    &#60;% sites.each do &#124;name, link&#124; %&#62;
        &#60;li&#62;&#60;a href=&#34;&#60;%= link %&#62;&#34;&#62; &#60;%= name %&#62;&#60;/a&#62;&#60;/li&#62;
    &#60;% end %&#62;
    &#60;/ul&#62;
&#60;/body&#62;
&#60;/html&#62;</pre>
<p>Save this to <code>tutsplus.erb</code>. Notice that the title text will be inserted with Ruby, as well as the list of sites. Now, let&#8217;s render it. We&#8217;ll do it this way (save this in <code>using_tilt.rb</code>):</p>
<pre class="ruby" name="code">require &#39;tilt&#39;

sites = {
    &#34;Nettuts+&#34; =&#62; &#34;http://net.tutsplus.com&#34;,
    &#34;Psdtuts+&#34; =&#62; &#34;http://psd.tutsplus.com&#34;,
    &#34;Mobiletuts+&#34; =&#62; &#34;http://mobile.tutplus.com&#34;,
    &#34;Audiotuts+&#34;  =&#62; &#34;http://audio.tutsplus.com&#34; }

context = Object.new
def context.title
    &#34;Tuts+ Sites&#34;
end

template = Tilt::ERBTemplate.new(&#34;tutsplus.erb&#34;)

File.open &#34;sites.html&#34;, &#34;w&#34; do &#124;file&#124;
    file.write template.render(context, sites: sites )
end</pre>
<p>Of course, we start by requiring Tilt. Then, we create our data for the template: a simple hash, as well as a plain vanilla object. We give the object one property: <code>title</code>. Then, we create our template object. Here, we&#8217;re creating an instance of the <code>Tilt::ERBTemplate</code> class but the whole point of Tilt is that you can use whatever template engine you want: for example, you could use the <code>Tilt::HamlTemplate</code>, <code>Tilt::SassTempalte</code> (for CSS), <code>Tilt::CoffeScriptTemplate</code> (for CoffeeScript), or <a href='https://github.com/rtomayko/tilt/blob/master/TEMPLATES.md'>whatever supported template engine you want</a> However, it&#8217;s important to note that Tilt is <strong>just a wrapper</strong>: you need to require the appropriate library for the template engine you want to use. So, if you want to use a <code>Tilt::HamlTemplate</code> instance, you need to <code>require &#39;haml&#39;</code>. You can see what libraries are required for each template engine in <a href='https://github.com/rtomayko/tilt'>the Readme</a>.</p>
<p>Finally, we open the file we want to write the output to. The HTML (or CSS, or JavaScript, depending on the template and engine you&#8217;re using) will be returned from the <code>render</code> method of the template object. The <code>render</code> method takes two parameters. The first is a context object: all the properties of this object will be available as variable within the template. So, our <code>context.title</code> property will be available as just <code>title</code> within the template. If there are any other values you want to pass into the template, pass them as part of the second parameter, which is a hash.</p>
<p>So, we can run this script on the command line:</p>
<pre class="ruby" name="code">ruby using_tilt.rb</pre>
<p>Now, look in the directory that you&#8217;ve been saving these files in: you should see a <code>sites.html</code> file. If you view it, you&#8217;ll find that the template has been rendered:</p>
<div class="tutorial_image"><img alt='The Rendered Template' src='http://d2o0t5hpnwv4c1.cloudfront.net/979_ruby11/rendered.png' /></div>
<hr />
<h2>Yielding for More Power</h2>
<p>You can do more complex things with Tilt if you pass a block to the <code>render</code> method.</p>
<pre class="ruby" name="code">Tilt::ERBTemplate(&#39;other.erb&#39;).render(context, other_params) {
    &#34;some text&#34;
}</pre>
<p>Inside your template, you can <code>yield</code> to the block; whatever is returned from the block will be inserted at that point in the template.</p>
<p>While you can, of course, just pass a string via the block, as above, there&#8217;s a more interesting use case. Recently, I&#8217;ve been using this functionality in Tilt to embed a page-specific template inside a site-wide shell. For example, we can split our above template into two files:</p>
<h3>layout.erb</h3>
<pre class="html" name="code">&#60;!DOCTYPE html&#62;
&#60;html lang=&#34;en&#34;&#62;
&#60;head&#62;
    &#60;meta charset=&#34;UTF-8&#34; /&#62;
    &#60;title&#62;&#60;%= title %&#62;&#60;/title&#62;
&#60;/head&#62;
&#60;body&#62;
    &#60;%= yield %&#62;
&#60;/body&#62;
&#60;/html&#62;</pre>
<h3>sites.erb</h3>
<pre class="html" name="code">&#60;h2&#62;A few of the Tuts+ Sites&#60;/h2&#62;
&#60;ul&#62;
&#60;% sites.each do &#124;name, link&#124; %&#62;
    &#60;li&#62;&#60;a href=&#34;&#60;%= link %&#62;&#34;&#62; &#60;%= name %&#62;&#60;/a&#62;&#60;/li&#62;
&#60;% end %&#62;
&#60;/ul&#62;</pre>
<p>Now, to render our page, we can do this:</p>
<pre class="ruby" name="code">template = Tilt::ERBTemplate.new(&#34;layout.erb&#34;)

File.open &#34;sites.html&#34; do &#124;file&#124;
    file.write template.render(context) {
        Tilt::ERBTemplate.new(&#34;sites.erb&#34;).render(Object.new, sites: sites)
    }
end</pre>
<p>Notice that since we didn&#8217;t have any object we wanted to use as the context object, we just passed a plain vanilla blank Ruby object. The HTML that is returned from the rendering of <code>sites.erb</code> will be inserted where the <code>yield</code> keyword is. If you run the above code, you should see the same output as before.</p>
<hr />
<h2>Using Other Options</h2>
<p>You&#8217;ll notice that, up until now, we&#8217;ve had to choose the template engine we want to use when creating the Tilt subclass object. However, Tilt will recognise the file extension of the template you pass it, so you don&#8217;t have to explicitly choose an engine: it will pick the right one, based on the file extension:</p>
<pre class="ruby" name="code">t = Tilt.new &#34;tutsplus.erb&#34;

t.class # =&#62; Tilt::ERBTemplate</pre>
<p>If, for some reason, your templates have a file extension that&#8217;s not what Tilt would expect, you can register that:</p>
<pre class="ruby" name="code">Tilt.register Tilt::ERBTemplate, &#34;some_extension&#34;

t = Tilt.new &#34;my_template.some_extension&#34;

t.class # =&#62; Tilt::ERBTemplate</pre>
<hr />
<h2>Finding out More</h2>
<p>There are a few more niche things that Tilt can do; if you&#8217;re interested in finding out more, I recommend you <a href='https://github.com/rtomayko/tilt'>check out the documentation</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=w1uI2OVsepk:FGwUHdhkqug:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=w1uI2OVsepk:FGwUHdhkqug:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=w1uI2OVsepk:FGwUHdhkqug:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/w1uI2OVsepk" height="1" width="1"/>]]></description>
			<content:encoded><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=20027&c=1574921182' ><img src='http://rss.buysellads.com/img.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=20027&c=1574921182' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' >Advertise here</a></p><p>Ruby is a one of the most popular languages used on the web. We&#8217;ve started a new <a href='http://net.tutsplus.com/sessions/ruby-for-newbies/'>Session</a> here on Nettuts+ that will introduce you to Ruby, as well as the great frameworks and tools that go along with Ruby development. In this episode, we&#8217;ll be looking at <a href="https://rubygems.org/gems/tilt">Tilt</a>, an all-inclusive wrapper gem for Ruby template engines.</p>
<p><span id="more-20027"></span></p>
<hr />
<h2>Video Tutorial</h2>
<div class="tutorial_image">
<iframe src="http://blip.tv/play/gcMVgrrNTQA.html" width="600" height="338" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#gcMVgrrNTQA" style="display:none"></embed></p>
<div>Subscribe to our <a href="http://youtube.com/nettutsplus">YouTube</a> and <a href="http://http://nettuts.blip.tv/">Blip.tv</a> channels to watch more screencasts. </div>
</div>
<hr />
<h2>Rendering Templates</h2>
<p>If you&#8217;ve used a Ruby web framework&#8212;like Rails and Sinatra&#8212;you&#8217;re probably familiar with at least one of the many template engines available: I&#8217;m about about options like ERB or Haml. When using them in the context of a framework, it&#8217;s pretty simple &#8230; but sometimes they seem very embedded; what if you want to use them in your own project? Is there an easy way to harness their usefulness?</p>
<p>Enter the <a href='https://github.com/rtomayko/tilt/'>Tilt gem</a>. Billed as a &#8220;thin interface over a bunch of different Ruby template engines,&#8221; you&#8217;ll find it makes rendering templates a breeze.</p>
<p>Of course, we&#8217;ll install it first.</p>
<pre class="ruby" name="code">gem install tilt</pre>
<p>If you&#8217;re not using RVM (<a href='http://net.tutsplus.com/tutorials/why-you-should-use-rvm/'>which you should be</a>), you might have to run that with root privileges (<code>sudo</code>).</p>
<p>Of course, you&#8217;ll need to start with a template to render. We&#8217;ll keep it simple:</p>
<pre class="html" name="code">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot; /&gt;
    &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h2&gt;A few of the Tuts+ Sites&lt;/h2&gt;
    &lt;ul&gt;
    &lt;% sites.each do |name, link| %&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;%= link %&gt;&quot;&gt; &lt;%= name %&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;% end %&gt;
    &lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Save this to <code>tutsplus.erb</code>. Notice that the title text will be inserted with Ruby, as well as the list of sites. Now, let&#8217;s render it. We&#8217;ll do it this way (save this in <code>using_tilt.rb</code>):</p>
<pre class="ruby" name="code">require &#39;tilt&#39;

sites = {
    &quot;Nettuts+&quot; =&gt; &quot;http://net.tutsplus.com&quot;,
    &quot;Psdtuts+&quot; =&gt; &quot;http://psd.tutsplus.com&quot;,
    &quot;Mobiletuts+&quot; =&gt; &quot;http://mobile.tutplus.com&quot;,
    &quot;Audiotuts+&quot;  =&gt; &quot;http://audio.tutsplus.com&quot; }

context = Object.new
def context.title
    &quot;Tuts+ Sites&quot;
end

template = Tilt::ERBTemplate.new(&quot;tutsplus.erb&quot;)

File.open &quot;sites.html&quot;, &quot;w&quot; do |file|
    file.write template.render(context, sites: sites )
end</pre>
<p>Of course, we start by requiring Tilt. Then, we create our data for the template: a simple hash, as well as a plain vanilla object. We give the object one property: <code>title</code>. Then, we create our template object. Here, we&#8217;re creating an instance of the <code>Tilt::ERBTemplate</code> class but the whole point of Tilt is that you can use whatever template engine you want: for example, you could use the <code>Tilt::HamlTemplate</code>, <code>Tilt::SassTempalte</code> (for CSS), <code>Tilt::CoffeScriptTemplate</code> (for CoffeeScript), or <a href='https://github.com/rtomayko/tilt/blob/master/TEMPLATES.md'>whatever supported template engine you want</a> However, it&#8217;s important to note that Tilt is <strong>just a wrapper</strong>: you need to require the appropriate library for the template engine you want to use. So, if you want to use a <code>Tilt::HamlTemplate</code> instance, you need to <code>require &#39;haml&#39;</code>. You can see what libraries are required for each template engine in <a href='https://github.com/rtomayko/tilt'>the Readme</a>.</p>
<p>Finally, we open the file we want to write the output to. The HTML (or CSS, or JavaScript, depending on the template and engine you&#8217;re using) will be returned from the <code>render</code> method of the template object. The <code>render</code> method takes two parameters. The first is a context object: all the properties of this object will be available as variable within the template. So, our <code>context.title</code> property will be available as just <code>title</code> within the template. If there are any other values you want to pass into the template, pass them as part of the second parameter, which is a hash.</p>
<p>So, we can run this script on the command line:</p>
<pre class="ruby" name="code">ruby using_tilt.rb</pre>
<p>Now, look in the directory that you&#8217;ve been saving these files in: you should see a <code>sites.html</code> file. If you view it, you&#8217;ll find that the template has been rendered:</p>
<div class="tutorial_image"><img alt='The Rendered Template' src='http://d2o0t5hpnwv4c1.cloudfront.net/979_ruby11/rendered.png' /></div>
<hr />
<h2>Yielding for More Power</h2>
<p>You can do more complex things with Tilt if you pass a block to the <code>render</code> method.</p>
<pre class="ruby" name="code">Tilt::ERBTemplate(&#39;other.erb&#39;).render(context, other_params) {
    &quot;some text&quot;
}</pre>
<p>Inside your template, you can <code>yield</code> to the block; whatever is returned from the block will be inserted at that point in the template.</p>
<p>While you can, of course, just pass a string via the block, as above, there&#8217;s a more interesting use case. Recently, I&#8217;ve been using this functionality in Tilt to embed a page-specific template inside a site-wide shell. For example, we can split our above template into two files:</p>
<h3>layout.erb</h3>
<pre class="html" name="code">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot; /&gt;
    &lt;title&gt;&lt;%= title %&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;%= yield %&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h3>sites.erb</h3>
<pre class="html" name="code">&lt;h2&gt;A few of the Tuts+ Sites&lt;/h2&gt;
&lt;ul&gt;
&lt;% sites.each do |name, link| %&gt;
    &lt;li&gt;&lt;a href=&quot;&lt;%= link %&gt;&quot;&gt; &lt;%= name %&gt;&lt;/a&gt;&lt;/li&gt;
&lt;% end %&gt;
&lt;/ul&gt;</pre>
<p>Now, to render our page, we can do this:</p>
<pre class="ruby" name="code">template = Tilt::ERBTemplate.new(&quot;layout.erb&quot;)

File.open &quot;sites.html&quot; do |file|
    file.write template.render(context) {
        Tilt::ERBTemplate.new(&quot;sites.erb&quot;).render(Object.new, sites: sites)
    }
end</pre>
<p>Notice that since we didn&#8217;t have any object we wanted to use as the context object, we just passed a plain vanilla blank Ruby object. The HTML that is returned from the rendering of <code>sites.erb</code> will be inserted where the <code>yield</code> keyword is. If you run the above code, you should see the same output as before.</p>
<hr />
<h2>Using Other Options</h2>
<p>You&#8217;ll notice that, up until now, we&#8217;ve had to choose the template engine we want to use when creating the Tilt subclass object. However, Tilt will recognise the file extension of the template you pass it, so you don&#8217;t have to explicitly choose an engine: it will pick the right one, based on the file extension:</p>
<pre class="ruby" name="code">t = Tilt.new &quot;tutsplus.erb&quot;

t.class # =&gt; Tilt::ERBTemplate</pre>
<p>If, for some reason, your templates have a file extension that&#8217;s not what Tilt would expect, you can register that:</p>
<pre class="ruby" name="code">Tilt.register Tilt::ERBTemplate, &quot;some_extension&quot;

t = Tilt.new &quot;my_template.some_extension&quot;

t.class # =&gt; Tilt::ERBTemplate</pre>
<hr />
<h2>Finding out More</h2>
<p>There are a few more niche things that Tilt can do; if you&#8217;re interested in finding out more, I recommend you <a href='https://github.com/rtomayko/tilt'>check out the documentation</a>.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=w1uI2OVsepk:FGwUHdhkqug:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=w1uI2OVsepk:FGwUHdhkqug:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=w1uI2OVsepk:FGwUHdhkqug:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=w1uI2OVsepk:FGwUHdhkqug:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/w1uI2OVsepk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/nettuts/~3/w1uI2OVsepk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build your Own JavaScript Library: Premium Series</title>
		<link>http://feedproxy.google.com/~r/nettuts/~3/k17scFCGx7w/</link>
		<comments>http://feedproxy.google.com/~r/nettuts/~3/k17scFCGx7w/#comments</comments>
		<pubDate>Thu, 12 May 2011 17:35:05 +0000</pubDate>
		<dc:creator>Jeremy McPeak</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=16708</guid>
		<description><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=16708&#038;c=621502147' target='_blank'><img src='http://rss.buysellads.com/img.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=16708&#038;c=621502147' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' target='_blank'>Advertise here</a></p><p>Over the course of the past few years, the JavaScript community has exploded exponentially. It it&#8217;s safe to assume that libraries are the primary reason we&#8217;ve seen such astonishing growth. Thanks to these  libraries, the differences between the popular browsers are minimized, making cross-browser development much easier than it used to be. We&#8217;ll build our own in this series!</p>
<p><strong><a href="http://net.tutsplus.com/about/join-plus/">Become a Premium member</a> to read this kick-butt tutorial and screencast series, as well as hundreds of other advanced tutorials and screencasts.</strong></p>
<p><span id="more-16708"></span></p>
<div class="tutorial_image">
<a href="http://marketplace.tutsplus.com/item/build-your-own-javascript-library/159166"><br />
    <img src="http://s3.envato.com/files/2456009/javascript-library.jpg" alt="" /><br />
</a>
</div>
<hr />
<h2>Included in this Two-Part Series:</h2>
<ul>
<li> A full, in depth, written tutorial for each lesson. </li>
<li> For visual learners, the same tutorial, in video form &#8211; hosted by Jeremy McPeak </li>
<li> Each lesson&#8217;s source code </li>
</ul>
<hr />
<h2>Join Net Premium</h2>
<div class="tutorial_image"><img src="http://miscfiles.s3.amazonaws.com/banners/nettuts_468x60.jpg" border=0 alt="NETTUTS+ Screencasts and Bonus Tutorials" width=468 height=60></div>
<p>
For those unfamiliar, the family of <a href="http://tutsplus.com">Tuts+</a> sites runs a premium membership service. For $9 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from <a href="http://net.tutsplus.com">Nettuts+</a>, <a href="http://psd.tutsplus.com">Psdtuts+</a>, <a href="http://ae.tutsplus.com">Aetuts+</a>, <a href="http://audio.tutsplus.com">Audiotuts+</a>, <a href="http://vector.tutsplus.com">Vectortuts+</a>, <a href="http://photo.tutsplus.com">Phototuts+</a>, and <a href="http://cg.tutsplus.com">CgTuts+</a> For the price of a pizza, you&#8217;ll learn from some of the best minds in the business. <a href="http://net.tutsplus.com/about/join-plus/">Become a Premium member</a> to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=k17scFCGx7w:8hj5UujshhM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=k17scFCGx7w:8hj5UujshhM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=k17scFCGx7w:8hj5UujshhM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/k17scFCGx7w" height="1" width="1"/>]]></description>
			<content:encoded><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=16708&c=621502147' ><img src='http://rss.buysellads.com/img.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=16708&c=621502147' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' >Advertise here</a></p><p>Over the course of the past few years, the JavaScript community has exploded exponentially. It it&#8217;s safe to assume that libraries are the primary reason we&#8217;ve seen such astonishing growth. Thanks to these  libraries, the differences between the popular browsers are minimized, making cross-browser development much easier than it used to be. We&#8217;ll build our own in this series!</p>
<p><strong><a href="http://net.tutsplus.com/about/join-plus/">Become a Premium member</a> to read this kick-butt tutorial and screencast series, as well as hundreds of other advanced tutorials and screencasts.</strong></p>
<p><span id="more-16708"></span></p>
<div class="tutorial_image">
<a href="http://marketplace.tutsplus.com/item/build-your-own-javascript-library/159166"><br />
    <img src="http://s3.envato.com/files/2456009/javascript-library.jpg" alt="" /><br />
</a>
</div>
<hr />
<h2>Included in this Two-Part Series:</h2>
<ul>
<li> A full, in depth, written tutorial for each lesson. </li>
<li> For visual learners, the same tutorial, in video form &#8211; hosted by Jeremy McPeak </li>
<li> Each lesson&#8217;s source code </li>
</ul>
<hr />
<h2>Join Net Premium</h2>
<div class="tutorial_image"><img src="http://miscfiles.s3.amazonaws.com/banners/nettuts_468x60.jpg" border=0 alt="NETTUTS+ Screencasts and Bonus Tutorials" width=468 height=60></div>
<p>
For those unfamiliar, the family of <a href="http://tutsplus.com">Tuts+</a> sites runs a premium membership service. For $9 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from <a href="http://net.tutsplus.com">Nettuts+</a>, <a href="http://psd.tutsplus.com">Psdtuts+</a>, <a href="http://ae.tutsplus.com">Aetuts+</a>, <a href="http://audio.tutsplus.com">Audiotuts+</a>, <a href="http://vector.tutsplus.com">Vectortuts+</a>, <a href="http://photo.tutsplus.com">Phototuts+</a>, and <a href="http://cg.tutsplus.com">CgTuts+</a> For the price of a pizza, you&#8217;ll learn from some of the best minds in the business. <a href="http://net.tutsplus.com/about/join-plus/">Become a Premium member</a> to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=k17scFCGx7w:8hj5UujshhM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=k17scFCGx7w:8hj5UujshhM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=k17scFCGx7w:8hj5UujshhM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=k17scFCGx7w:8hj5UujshhM:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/k17scFCGx7w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/nettuts/~3/k17scFCGx7w/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers</title>
		<link>http://www.smashingmagazine.com/2011/05/12/getting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers/</link>
		<comments>http://www.smashingmagazine.com/2011/05/12/getting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers/#comments</comments>
		<pubDate>Thu, 12 May 2011 12:39:56 +0000</pubDate>
		<dc:creator>Michael Tuck</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.smashingmagazine.com/?p=100414</guid>
		<description><![CDATA[<table width="650"><tr><td width="650"><div style="width:650px;"> <img src="http://statisches.auslieferung.commindo-media-ressourcen.de/advertisement.gif" alt="" border="0" /><br /> <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=34" border="0" alt="" /></a>&#160;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=35" border="0" alt="" /></a>&#160;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=36" border="0" alt="" /></a></div></td></tr></table><p>According to Brandweek, “brands are the express checkout for people living their lives at ever increasing speed. This article shows you how, and why, to add “app”-like icons to your sites for several mobile and desktop browser displays, to clearly and elegantly identify your site with an icon that stands out from the crowd.</p><p><a href="http://www.smashingmagazine.com/2011/05/12/getting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/mtdesktop_lg1.jpg" width="500" height="272" alt="Screenshot" /></a></p> <iframe class="facebooklike" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.smashingmagazine.com%2F2011%2F05%2F12%2Fgetting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers%2F&#38;layout=standard&#38;show_faces=false&#38;width=450&#38;action=like&#38;colorscheme=light&#38;height=35" scrolling="no" frameborder="0"></iframe><p>When I was a lad growing up in rural America, we only got four channels on television, all local affiliates of the four national networks (yes, four; you’re forgetting PBS, which I only watched when they did dinosaur specials). The ABC and CBS stations came in fairly clear if you adjusted the “rabbit ears” antennae just right, and wrapped tinfoil on ’em.</p> ]]></description>
			<content:encoded><![CDATA[<table width="650"><tr><td width="650"><div style="width:650px;"> <img src="http://statisches.auslieferung.commindo-media-ressourcen.de/advertisement.gif" alt="Advertisement in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers" border="0" /><br /> <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=34" border="0" alt=" in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=35" border="0" alt=" in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=36" border="0" alt=" in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a></div></td></tr></table><p>According to <a href="http://www.allaboutbranding.com/index.lasso?article=22">Brandweek</a>, &#8220;brands are the express checkout for people living their lives at ever increasing speed. This article shows you how, and why, to add “app”-like icons to your sites for several mobile and desktop browser displays, to clearly and elegantly identify your site with an icon that stands out from the crowd.</p><h3>Logo Presentation And The Nine Basic Ballet Movements</h3><p>When I was a lad growing up in rural America, we only got four channels on television, all local affiliates of the four national networks (yes, four; you’re forgetting PBS, which I only watched when they did dinosaur specials). The ABC and CBS stations came in fairly clear if you adjusted the “rabbit ears” antennae just right, and wrapped tinfoil on ’em.</p><p><a href="http://www.davidebowman.com/wp-content/uploads/2010/06/iStock_000006029379Small.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/rabbitears.jpg" alt="Rabbitears in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Not too far off from what sat in our living room. (Photo credit: <a title="David E. Bowman" href="http://www.davidebowman.com/black-and-white-television.htm">David E. Bowman</a>, used by permission.)</em></p><p>NBC’s station came in over the new-fangled and somewhat unfathomable UHF channels — we had to actually twiddle a dial that looked like an old radio selector to tune it in. That channel was always static-laden, and required not only tinfoil on the rabbit ears, but sometimes needed my brother or me to stand next to the TV, carefully grab one of the rabbit ears, and, in my wife’s words years later, assume one of the nine basic ballet positions. (Her dad did the same thing to her, until he got angry at something President Johnson said and kicked out the picture tube. True story.) If we did the grand plié just right, the NBC channel would come in nice and clear, at least until <a title="Dallas Cowboys quarterback Don Meredith" href="http://en.wikipedia.org/wiki/Don_Meredith">Don Meredith</a> dropped back for the touchdown pass and the signal would go out.</p><p>The television was also a black-and-white job.</p><p>So, given all of that static and lack of color, the lack of a screen display and the inability of anyone who lacked sniper-quality vision to discern what the number was on the little plastic channel dial from across the room, how were we to know what channel we were watching at a glance?</p><p>Short answer, we didn’t. Longer answer, we depended on the networks, or the local station, to tell us. That <strong>involved the use of a logo</strong>, on the networks’ choice of identifying themselves — part of their branding.</p><p><a href="http://www.ev1.pair.com/KARD72photos/colortv_50s_peacock-endlogo.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/oldabclogo.jpg" alt="Oldabclogo in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>The 1960s version of the ABC Network logo. (Photo credit: <a title="Kris Trexler" href="http://www.ev1.pair.com/colorTV/colorTVlogos.html">Kris Trexler</a>, used by permission.)</em></p><p>In those days of low, low-resolution black-and-white signals, we sometimes had to depend on <a title="NBC ABC CBS color presentation logos" href="http://www.ev1.pair.com/colorTV/colorTVlogos.html">the network logos</a> to determine what station we were watching. I wasn’t old enough to see the logo ABC used in the 1950s (the letters stenciled in light gray on the side of a television camera, very unreadable), but I do remember the 1960s version: three smaller-case letters in RGB colors (they looked like different shades of gray to us) in a black circle. Easy to see and understand. ABC still uses a variant of this logo.</p><p><a href="http://www.fanpop.com/spots/nbc/images/528091/title/nbc-logo-old-school-photo"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/oldnbclogo.jpg" alt="Oldnbclogo in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>The 1960s version of the NBC Network logo. (Photo credit: <a title="Fanpop" href="http://www.fanpop.com/spots/nbc/images/528091/title/nbc-logo-old-school-photo">Fanpop</a>.)</em></p><p>NBC flaunted its embrace of color by pasting a color-bedazzled peacock on screen. It gave us a rather undistinctive text block at the bottom of the screen, and we couldn’t see the colors, so it didn’t convey quite as strongly (besides, no one wanted to watch NBC programs if it meant you got to stand by the antennae in allongé position for more than a few minutes). The peacock survives, in a much more stylized form, today.</p><p><a href="http://www.solarnavigator.net/films_movies_actors/film_images/CBS_colour_eye_logo.png"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/oldcbslogo.png" alt="Oldcbslogo in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>The 1960s version of the CBS Network logo. (Photo credit: <a title="Solar Navigator" href="http://www.solarnavigator.net/films_movies_actors/CBS.htm">Solar Navigator</a>.)</em></p><p>CBS used the “Eye of Horus” (they still use a version of it) flanked by three nicely serifed letters in a different RGB arrangement of colors — again, easily identifiable.</p><h3>Self-Identification And Browser Speed Dials</h3><p>This blast from the static-riddled past came to mind when I installed Opera 11.10 (code-named <em><a title="Make your Speed Dial look great with Opera Barracuda" href="http://my.opera.com/desktopteam/blog/2011/04/12/make-your-speed-dial-look-great-with-opera-barracuda">Barracuda</a></em> in Opera’s best double-naught spy naming tradition) on my machine the other week. I didn’t install it the day, or the week, it came out, in part because I’m lazy and in part because I like to read up a bit on how the new browser iterations are doing before I throw my doors open and invite them in. I installed it today, or more accurately Opera got tired of me ignoring it and installed it itself, and I instantly noticed a change.</p><p>I use <a title="Opera Speed Dial Improvements" href="http://www.ghacks.net/2011/02/25/opera-speed-dial-improvements/">Opera’s Speed Dial facility</a> for my home page, and two things were different. One, there were more (and smaller) icon docks, requiring me to fill up the screen with a few more bookmarked sites (can’t have spots unfilled, it’s asymmetrical and my OCD wouldn’t like it). Moreover, I noticed that some sites didn’t use the usual half-random screenshots to serve as their icons. Instead, some of them, like <a title="SitePoint" href="http://www.sitepoint.com/">SitePoint</a> and <a title="Google Images" href="http://images.google.com/">Google Images</a>, seemed to now sport spiffy, iPad-like icons (minus the glossy overlay). Previous iterations of Opera merely gave screen capture “icons.”</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/mtdesktop_lg.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/mtdesktop_lg1.jpg" alt="Mtdesktop Lg1 in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>A portion of my current desktop in Opera 11. The variances in the icon displays are obvious.</em></p><p>It was obvious how useful the little icons are. The chunky SitePoint blue/orange stylized “S” for example, is instantly discernible, as is the colorful Google Images “logo” (like CBS, they use a tastefully subdued serif font along with an array of bright Crayola colors). On the other hand, some sites not using the icons didn’t fare so well. Mine, for example. I got a nearly-random screenshot of my LinkedIn and Twitter contact icons, nearly useless for identifying anything. A Facebook page I visit regularly got turned into a blurry mush, as <strong>the program squished the entire page down</strong> into a barely discernible thumbnail shot. The screengrabs for <em>Six Revisions</em> and <em>Smashing Magazine</em> didn’t do so hot, either; without the text blocks on the bottom of those icons, I couldn’t easily tell what page it was (though Smashing’s logo is more discernible than Six Revisions’s). And who wants to rely on a text block to identify something?</p><p>So, with a few minutes’ Googling, I found out that the icons are completely controllable from the client end — in other words, just like <a title="5 Web Files That Will Improve Your Website" href="http://sixrevisions.com/web-standards/5-web-files-that-will-improve-your-website/">the Apple iPad/iPod/iPhone icons</a> that we can also use on our websites (Apple calls them <a title="How to Create Your Website Icon for iPhone and iPod Touch" href="http://appleslut.com/blog/ipod/how-to-create-your-website-icon-for-iphone-ipod-touch">Webpage Icons</a>; Android&#8217;s mobile browser uses something similar), we can add an icon that will stand out on Opera users’ Speed Dial. I also found that if we prefer, we can use Speed Dial-specific CSS or content, and even add a soupçon of HTML 5 goodness.</p><p>In other words, we control the appearance. I don’t know about you, but in this day and age of not rationally being able to design sites that appear pixel-identical from browser to browser, I’ll take <strong>a bit of control over appearance and presentation any time</strong> I can get it. And, as we’ll see shortly, the effect isn’t limited to Opera’s desktop Speed Dial, but translates to many mobile displays as well.</p><p>And doesn’t it look like a mobile desktop display? More on that later.</p><p>(Not sure how to get Opera to display Speed Dial as the home page? <em>Online How To</em> gives <a title="How to set a home page in Opera 11" href="http://www.onlinehowto.net/Tutorials/Opera/How-to-set-a-home-page-in-Opera-11/1819">a quick and easy walkthrough</a>, though as the article notes, Opera 11 uses Speed Dial as its default for the home page selection. <a title="How to change Speed Dial thumbnail images in Opera?" href="http://my.opera.com/Tamil/blog/how-to-change-speed-dial-thumbnail-images-in-opera?startidx=100">Here’s how to change Speed Dial icons</a> on your, and only your, browser. And if you are new to the whole idea of Speed Dial, Opera’s given us <a title="Meet our new Speed Dial" href="http://www.youtube.com/watch?v=5_vxCY4BF_Y">a slick, short YouTube video</a> to peruse.)</p><p><a href="http://www.technobuzz.net/wp-content/uploads/2009/12/4001.png"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/chromespeeddial.png" alt="Chromespeeddial in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Chrome with Speed Dial extension, in a screenshot from December 2009. (Photo credit: <a title="Technobuzz" href="http://www.technobuzz.net/replace-google-chrome-tab-with-speed-dial-extension/">Technobuzz</a>.)</em></p><p>Firefox has a <a title="Speed Dial extension for Firefox" href="https://addons.mozilla.org/en-US/firefox/addon/speed-dial/">Speed Dial extension</a> that I started using after I got spoiled by Opera’s own feature. Firefox also offers a similar extension called <a title="Fast Dial" href="https://addons.mozilla.org/en-US/firefox/addon/fast-dial-5721/">Fast Dial</a>, but it seems to have some <a title="Workarounds to problems with Fast Dial and Firefox 3.5" href="http://userlogos.org/node/8788">workability issues</a>. Chrome also has an extension that <a title="Chrome Speed Dial extension" href="https://chrome.google.com/extensions/detail/dgpdioedihjhncjafcpgbbjdpbbkikmi#">gives its users a Speed Dial</a>, and in a fashion somewhat similar to Opera, it allows for the use of site logos as dial icons, though without the customizability.</p><p>Internet Explorer 9 has its own <a title="Set IE9's Speed Dial as your Home page" href="http://mintywhite.com/more/software-more/set-ie9s-speed-dial-home-page-quick-tip/">built-in Speed Dial feature</a> that is similar to Chrome’s, though it doesn’t seem particularly customizable (I don’t use IE9, so I can’t say with any authority). Mac users have a reason to preen, as <a title="Use a 'speed dial' homepage in Safari" href="http://hints.macworld.com/article.php?story=20081005140513961">Safari has done Speed Dial</a> for years, perhaps <a title="Safari has Speed Dial too" href="http://downloadsquad.switched.com/2007/05/09/safari-has-speed-dial-too/">as far back as 2003</a>, though I understand it’s <a title="Safari Dial" href="http://safaridial.com/">an online app</a> and not necessarily a browser inclusion (I don’t use Macs, either, so someone here can correct me). PCMag’s Michael Muchmore claims <a title="Opera 11.10" href="http://www.pcmag.com/article2/0,2817,2375401,00.asp">Opera did the Speed Dial first</a>, for what that’s worth.</p><h3>Going Mobile: Stealing A March On The Future</h3><p>The question of “why bother?” is valid. After all, Opera’s desktop browser has less than a 5% market share no matter whose numbers you accept, and I’m certain most users of other browsers don’t use their Speed Dial facilities. But that’s not the entire deal. Opera is well known as a cutting-edge browser whose best features often find their way into other, more popular browsers down the road. (A <a title="Innovations by Opera" href="http://operawiki.info/operainnovations">list of Opera innovations going back to 1994</a> is available on Opera’s Wiki, if you’re interested. Opera has introduced such features as screen zooming, user-defined CSS, mouse gestures, pop-up blocking, and voice navigation, and it’s had Speed Dial since version 9.20 in 2007.)</p><p>I’m not going to start trying to sell Opera to you, you use whatever browser you prefer, but if Opera’s doing it today, Firefox and Chrome and the rest will likely do it tomorrow. So making an Speed Dial icon for your site now might only delight the very small percentage of users who use that facility for now, but chances are that icon, or a variant thereof, will come in handy for another browser’s own take on Speed Dial in the near future. Opera’s desktop enhancements often move on to the Opera Mobile and Mini browsers, which at last take <a title="Opera reaches (another) 100 million users" href="http://www.opera.com/press/releases/2011/04/07/">have well over 100 million users between them</a>. That’s a significant user share. And, as we’ll see along the way, the same technique can be used for placing your logo on Apple’s mobile touch-screen devices.</p><p>Speed Dials are nothing new, certainly. But the ability to customize them, now for Opera and almost certainly for other browsers in the near future, is something fairly different.</p><p><a href="http://blogs.amd.com/home/files/2010/04/Desktop.png"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/ipaddesktop.jpg" alt="Ipaddesktop in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Apple iPad desktop, in a screenshot from April 2010. (Photo credit: <a title="Pat Moorhead" href="http://blogs.amd.com/home/2010/04/12/at-work-with-an-ipad-pc-exchange-enterprise-productivity/">Pat Moorhead</a>.)</em></p><p>It’s also becoming axiomatic that if you’re designing for the future (even if that future is next month), you’re designing for mobile. If you’re not designing for mobile, you’re not serving your clients. Author and UI expert Luke Wroblewski points out that <a title="Data Monday: The Transition" href="http://www.lukew.com/ff/entry.asp?1298">the trend towards mobile is already large</a> and growing by leaps and bounds, and cites the stats to back it up.</p><p>A research firm made a bold prediction in December 2009 that by some time in 2012, global shipments of smartphones would surpass global shipments of desktops, notebooks, and laptops combined. That happened in late 2010, almost two years early. The gap will continue to increase. Since 2008, home usage of PCs has declined 20%, and will continue to shrink, as consumers increasingly rely on their smartphones to surf the Web.</p><p>In 2011, worldwide PC shipments fell over 3% and will continue to fall; US shipments fell over 10%. Many buyers who would have purchased a PC <strong>are now buying tablets such as the iPad</strong>. 22-25% of American and British mobile Internet users don’t bother with a desktop computer at all for Internet surfing. By November 2010, the number of visitors to web-based email sites dropped by 6%, while at the same time the number of users accessing their email by their mobile devices grew 36%. And of the mobile devices out there, Smashing Magazine author Nick Francis tells us that <a title="Web Development For The iPhone And iPad: Getting Started" href="http://www.smashingmagazine.com/2010/05/28/web-development-for-the-iphone-and-ipad-getting-started/">half of the smartphones being sold today run on the iPhone OS</a>, and half of the remainder run on the Android OS. The Apple iPad tablet is <a title="iPad Sales Estimated to Top 600,000" href="http://www.pcworld.com/article/193781/ipad_sales_estimated_to_top_600000.html">selling like crazy</a>.</p><p>Besides making me feel old (how about you?), these stats tell me that if I’m designing for a client and ignoring their mobile needs — and particularly failing to focus on the need to address their users’ Apple devices — I’m not serving their interests. The client may not even know that you’re not giving them what they need, but <strong>it’s on the designer and developer to know that needs exists</strong>, not the client. We know that more and more of our clients’ users may still be using a desktop or notebook to access the Internet today, but tomorrow they’ll be using a smartphone, and if not tomorrow, then check back next week, because they’ll have made the switch. Moreover, they think of websites less and less as “sites” and more as “apps” (even though we know the terms <a href="http://sixrevisions.com/web-applications/building-mobile-web-apps-the-right-way-tips-and-techniques/" title="Building Mobile Web Apps the Right Way: Tips and Techniques">aren&rsquo;t interchangeable</a>).</p><p>The techniques we’ll learn here apply right now to Opera Speed Dial for the PC and for the Apple touch screens. Tomorrow they’ll apply to more devices, probably the Opera Mobile and perhaps the Mini. And, I believe, other desktop/laptop (think “fixed” computers, though the term isn’t quite accurate) as well: I have a feeling that in a year’s time, or perhaps two, a <em>lot</em> of browsers’ home-page displays will employ some version of a mobile-like Speed Dial facility. Let’s steal a march on the future (and on our competitors) and see how it works.</p><h3>Step One: How To Customize Your Site For Opera’s Speed Dial</h3><blockquote><p>[Y]ou can offer [an icon] that can be displayed on the [Apple touch screen] devices’ Home screen using the web clip feature. &mdash; <a title="5 Web Files That Will Improve Your Website" href="http://sixrevisions.com/web-standards/5-web-files-that-will-improve-your-website/">Alexander Dawson, Six Revisions</a></p></blockquote><blockquote><p>The new [Opera] implementation also allows site developers to choose what appears in users’ Speed Dial entries for their sites. — <a title="Opera 11.10" href="http://www.pcmag.com/article2/0,2817,2375401,00.asp">Michael Muchmore, PC Magazine</a></p></blockquote><p>Dev Opera’s Tiffany Brown wrote a <a title="Make your site shine in Speed Dial" href="http://dev.opera.com/articles/view/opera-speed-dial-enhancements/">quick and well-detailed how-to guide</a> for whipping out an Opera Speed Dial icon for your browser, or for customizing your dial icon via CSS or other content. Brown verifies that if you don’t do anything special, Opera’s Speed Dial will just use the usual screen capture, and we already know how poorly that can turn out for you.</p><p>Unsurprisingly, the process started with the idea of the “favicon,” or the bookmark icon. We’ve been incorporating those as far back as 1999, when <a title="Favicon" href="http://en.wikipedia.org/wiki/Favicon">Microsoft bowled us all over with their inclusion in IE 5</a>. They aren’t part of the HTML 4 specifications, but that didn’t stop many people, and browser vendors not named Microsoft didn’t wait long to add support for <code>icon</code> as a value for the <code>rel</code> attribute of the <code>link</code> element. Apple built on the idea of the <a title="Configuring Web Applications" href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html">favicon for its touch-device icons</a> through the <code>apple-touch-icon</code> value. And HTML 5 has added <code>icon</code> as a valid and standardized value for the <code>rel</code> attribute, unless they change it next Tuesday.</p><p>(<strong>Note</strong>: Opera will <em>not</em> pick up a favicon for Speed Dial bookmarks. If it doesn’t find some kind of icon dedicated to the purpose &mdash; Opera doesn’t require the Opera-specific coding, but it does require <code>link rel</code> coding specifically for an icon. It won’t default to displaying the favicon, but instead will give users a screen capture as an “icon.”)</p><h4>The Basic Icon Code</h4><p>It doesn’t take a lot of time or effort to code a new icon for yourself. Brown gives us the dirt-simple code needed for the head of your document:</p><pre class="brush: html">&lt;head&gt;
   &lt;title&gt;Spiffy page with Opera Speed Dial icon&lt;/title&gt;
      &lt;link rel="icon" type="image/png" href="http://path/to/logo.png"&gt;
&lt;/head&gt;</pre><p>It doesn’t get much easier than that (you can even leave out the <code>type="image/png"</code>, as the PNG MIME type is assumed). You can see the <code>rel</code> difference from the Apple-specific code used for the Apple touch icons:</p><pre class="brush: html">&lt;link rel="apple-touch-icon" href="http://path/to/applelogo.png"&gt;</pre><p>The icons themselves are a bit different from the Apple-dedicated icons, and may require you to take a run through Photoshop, GIMP, or your graphics editor of choice. The specs are simple. The minimum size is 114px by 114px (smaller ones, such as the Apple-sized 57&#215;57 PNG icons, will be ignored, though Apple devices will use almost any reasonably sized icon, scale it down to 57&#215;57, and add its own rounded corners — more on this in a bit) and the maximum is 256px in width by 160px in height. (Display sizes can be changed in the <code>opera:config</code> menu from your browser, but that only works for you and not the Opera user in Katmandu.) The file must be in either PNG, JPG, or GIF format — no SVGs.</p><p>(Web developer Mathias Bynens <a href="http://mathiasbynens.be/notes/touch-icons" title="Everything you always wanted to know about touch icons">chided Apple</a> for not &ldquo;implement[ing] the standard <code>&lt;link rel=icon&gt;</code> and [coming] up with a more verbose proprietary link relation instead.&rdquo; I have to agree.)</p><h4>Using Multiple Icons</h4><p>If you use an animated image, only the first frame will be used, so don’t bother. But, you can use <em>multiple</em> icons. What’s the difference? It will let you give users one icon to bookmark a page and a second for their Speed Dial. You’ll have to decide whether this is a nice plus or a source of potential confusion — we usually like some degree of uniformity among our logo presentations, for identification purposes.</p><p>If you want to go down that road, it’s not much harder than the first one. Here’s how:</p><pre class="brush: html">&lt;head&gt;
   &lt;title&gt;Spiffy page with Opera Speed Dial icon&lt;/title&gt;
      &lt;link rel="icon" type="image/png" href="http://path/to/128x128image.png"&gt;
      &lt;link rel="icon" type="image/png" href="http://path/to/200x200image.png"&gt;
&lt;/head&gt;</pre><p>The larger one will be chosen by Speed Dial as its icon, regardless of whether it comes first or second in the list. If both icons are the same size, Speed Dial will use the first and the second one will become the favicon.</p><p>So far it’s been easy. The next part is, well, easy too, but allows for a good bit more customization if you choose to implement it.</p><h4>Using view-mode: minimized</h4><p>Opera’s <code>view-mode</code> media feature lets you specify styles by viewing mode. If you use <code>view-mode: minimized</code>, you can do more than just provide a bigger, splashier favicon for your visitors’ Speed Dial. <code>View-mode</code> works like other media features such as <code>device-width</code>. You probably already knew the media query needs to be within an <code>@media</code> block. Here’s the code:</p><pre class="brush: css">@media screen and (view-mode: minimized) {
   body {
      color: #fff;
      background: #b20000;
   }
}</pre><p>This still has Opera use a screengrab as its “icon,” but it customizes the appearance: in this case, changing the font and background colors.</p><p>If you’d rather, you can link to an external style sheet (we’ll debate the pros and cons of that method some other time), and set the value of the media attribute to <code>(view-mode: minimized)</code>:</p><pre class="brush: css">&lt;link rel=stylesheet type="text/css" href="minimizedstyles.css" media="(view-mode:minimized)"&gt;</pre><p>If you use <code>(view-mode: minimized)</code>, you’ll trigger a Speed Dial viewport that is 256 pixels wide by 160 pixels high. That may not be an issue for you, but it’s something to know.</p><p>What you definitely need to know is that if you use <code>view-mode: minimized</code> CSS, Speed Dial will use that as its first priority, over a more generically provided icon.</p><h4>Other Possibilities</h4><p>Brown gives examples of several other facilities: serving a different URL via an HTTP request, cycling through a number of pre-selected icons using auto-reload, using <code>mod_rewrite</code> to redirect Speed Dial requests, and using a server-side language such as PHP to serve different content at the same URL. If you find these interesting, I’ll leave you to review <a title="Make your site shine in Speed Dial" href="http://dev.opera.com/articles/view/opera-speed-dial-enhancements/">her article</a> if you want to explore those aspects of Speed Dial.</p><h4>Extras</h4><p>The visual users among us might appreciate <a title="Pimp your website for Speed Dial in Opera 11.10" href="http://www.youtube.com/watch?v=GeHYPLS-K2I">the YouTube walkthrough</a> Opera gives us.  Opera Mobile, very popular on Android and Symbian devices, <a title="Opera Mobile Speed Dial" href="http://www.youtube.com/watch?v=i9zZD2BtobY">also uses Speed Dial</a>, as does <a title="Using Opera Mini" href="http://help.opera.com/operamini/2.0/en/start.html">Opera Mini</a>, though neither Mobile nor Mini versions allow for client-side customization just yet. (Firefox and Chrome’s mobile versions have their own versions of Speed Dial, as does the Dolphin mobile browser.) If you’re up for taking a brief stroll into the weeds, the Dev Opera forum has a <a title="Make your site shine in Speed Dial forum discussion" href="http://dev.opera.com/forums/topic/929792">discussion</a> on Brown’s article. And Opera’s planning on <a title="Creating Opera Speed Dial Extensions" href="http://dev.opera.com/articles/view/creating-opera-speed-dial-extensions/">adding extensions</a> to the Speed Dial in the new desktop release.</p><h4>Gallery of Websites’ “App” Icons</h4><p><a href="http://cdn.ghacks.net/wp-content/uploads/2011/02/opera-speed-dial.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/speeddial.jpg" alt="Speeddial in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>An older Opera Speel Dial screenshot from early 2011. (Photo credit: <a title="Martin Brinkmann and Ghacks.net" href="http://www.ghacks.net/2011/02/25/opera-speed-dial-improvements/">Martin Brinkmann and Ghacks.net</a>, used by permission.)</em></p><p>You saw how my computer looks with the new Speed Dial activated. For comparison purposes, this is how the Opera Speed Dial looked before Opera 11 on a desktop monitor without the use of the spiffy new customized icons. Not bad, but you can see how some of the screen captures don’t stand out very well. Even when I zoom the graphic, I can’t tell what sites all the screengrabs represent. The point? Many websites’ “app icons” still look the same in the upgraded Speed Dial. But, they don’t have to.</p><p><a href="http://devfiles.myopera.com/articles/1551/OperaMobile_UI.png"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/OperaMobile_UI.png" alt="OperaMobile UI in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Opera Mobile screenshot from early 2011. Photo credit: <a title="Dev.Opera" href="http://dev.opera.com/articles/view/opera-mobile-10-developers-introduction/">Dev.Opera</a>, used under Creative Commons license.</em></p><p>For comparison purposes, here’s what the Speed Dial looks like on an Opera Mobile browser. Obviously, all of the “icons” are screen grabs. I expect Opera will upgrade its Mobile Speed Dial facility to be customizable in the near future.</p><p>Let’s find some icons on the spiffy new Speed Dial and see how they look individually. Here’s a group of them from my desktop:</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/desk1.jpg" alt="Desk1 in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Four not-so-randomly selected Speed Dial icons from my desktop, circa April 2011.</em></p><p>I just chose four that represent the idea of the customizable icon or the well-selected screenshot: Google Images, SitePoint, Yahoo Mail, and Media Matters. SitePoint uses the <code>apple-touch-icon</code> value in its coding, and the others either use more generic coding or just let the browser do its screengrab without any intervention. (The blue border around some of the icons is triggered by mouse hover, and comes from me being a bit sloppy as I selected the icons for screenshotting. I left the borders on some of the shots because I rationalized that we need to see what the icons look like both with and without borders, but mostly because I was too lazy to redo them.)</p><p>The visual benefits are apparent. Google Images and Yahoo use their <strong>colorful text as their brand identity</strong>. The Media Matters logo displays clearly, though it’s apparent that the “icon” is a nicely, and serendipitously, selected chunk of the top left quadrant of their display (you can see the slice of navigation bar in the icon, though I don’t think that detracts from the strong visual impact of the brand presentation). SitePoint, with the usage of their Apple icon<a title="SitePoint Apple Touch icon" href="http://blogs.sitepoint.netdna-cdn.com/wp-content/themes/sitepoint_2010/images/apple-touch-icon.png"> displaying on the Speed Dial screen</a>, probably makes the strongest impact. Very clean and strong, and instantly recognizable.</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/operaicon.jpg" alt="Operaicon in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Opera.com’s Speed Dial icon.</em></p><p>Here’s a shortcut to Opera’s own Speed Dial icon. Not surprisingly, they go with their big “O” logo, though I do miss the (apparently outdated) slanting shadow behind the letter. As with all the Speed Dial icons, the text is grabbed from the title of the page, explaining why it displays as “Opera brows …” We can, of course, control that with our own sites if we want to truncate or manipulate our titles to give a short, snappy text display, and users can configure their text to say whatever they want for the icon.</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/applespeed.jpg" alt="Applespeed in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Apple.com’s Speed Dial icon.</em></p><p>This is a shot of Apple.com’s Speed Dial icon. Who expected this? I was expecting <a title="Chrome Apple logo" href="http://www.homotron.net/images/homotron/apple_chrome_logo_small.jpg">some version of the “apple” logo</a>. It stands out nicely from the pack, and the title, the single word “Apple,” is effective, though I’m not sure the photo of the iPad does the trick for identification purposes.</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/iphone.jpg" alt="Iphone in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /> <img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/ipad.jpg" alt="Ipad in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Apple’s iPhone and iPad Speed Dial icons.</em></p><p>Surprisingly, neither <a title="Apple iPhone" href="http://www.apple.com/iphone/">Apple’s iPhone website</a> nor its <a title="Apple iPad" href="http://www.apple.com/ipad/">iPad site</a> use a dedicated icon and don’t use the <code>apple-touch-icon</code> coding. The screen capture for the iPhone site is fairly striking; for the iPad, perhaps less so. Perhaps Apple doesn’t expect mobile users to visit these sites?</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/microsoft.jpg" alt="Microsoft in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Microsoft.com’s Speed Dial icon.</em></p><p>Here’s the Microsoft Speed Dial icon. Or the screengrab that Opera uses for the icon. Obviously Microsoft isn’t trying to comply with Opera’s requirements, or Apple’s for that matter. Like almost everyone’s “icon” out there, it’s a screen capture from the top left of Microsoft’s home page. It’s serviceable, and that’s about all it has going for it.</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/poorex.jpg" alt="Poorex in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Speed Dial icons from WordPress.com and Facebook pages.</em></p><p>Here are screencaptured “icons” from a WordPress blog and a Facebook page that I work with. You can see just how unsatisfactorily these serve the purpose of branding icons. They’re just two screenshots of incredibly compressed content. Even the identifying text blocks don’t help much.</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/sixsmash.jpg" alt="Sixsmash in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Speed Dial icons from Six Revisions and Smashing Magazine.</em></p><p>These are the screencaptured “icons” from my bookmarks for Six Revisions and Smashing Magazine (showing then-current front page content). Although they’re not as bad as the two examples above, and Smashing’s logo is clearly visible, they’re not particularly pleasing. Six Revisions looks like a WordPress site, because the day I made the bookmark, the site was featuring <a title="Fine-Tuning WordPress for SEO" href="http://sixrevisions.com/wordpress/fine-tuning-wordpress-seo/">an article about fine-tuning WordPress for SEO purposes</a>. And Smashing’s article about <a title="Pixel Perfection When Rotating, Pasting And Nudging In Photoshop" href="http://www.smashingmagazine.com/2011/04/14/mastering-photoshop-pixel-perfection-when-rotating-pasting-and-nudging/">achieving pixel perfection in Photoshop</a> has long since gone off the front page, though a slice of the title remains in my icon. These icons don’t show fresh content, and don’t do justice to the sites they represent</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/nbcshot.jpg" alt="Nbcshot in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>NBC.com’s Speed Dial icon.</em></p><p>And ending where we started … While the other two major television networks just let Opera do a screengrab for their “icons,” NBC gives us the 21st-century version of the venerable peacock. They code a <a title="NBC logo" href="http://www.nbc.com/assets/images/v14/nbc-com-share.jpg">more widely applicable JPG</a> to serve the purpose.</p><h3>Step Two: Apple Plus Opera Equals a Sea Change In Browsing</h3><p><a href="http://www.geniosity.co.za/genwp/wp-content/uploads/2008/01/my-browser-home-page.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/ffhomepage.jpg" alt="Ffhomepage in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>An early version of a homemade “app” home page. (Photo credit: <a title="Geniosity" href="http://www.geniosity.co.za/musings/tips/productive-browser-homepage/">Geniosity</a>, used by permission.)</em></p><p>The idea of a home page as a collection of “apps,” or more accurately links to a variety of user-selected websites, was not introduced with either Safari’s or Opera’s first Speed Dial. Computer maven John Dvorak has had a version of his <a title="archive snapshot of Dvorak personal portal" href="http://replay.web.archive.org/19991013132231/http://dvorak.org/home.html">“personal portal home page”</a> available since 1999; all of his iterations use text links only, no icons, for faster loading time. More recently, a developer who blogs at Geniosity wrote about his own handcrafted, text-link driven <a title="Productive Browser Homepage" href="http://www.geniosity.co.za/musings/tips/productive-browser-homepage/">home page he created for his copy of Firefox</a> (image at left). The author tells me he still uses a version of this for his home page.There are other examples out there for the Googling.</p><p>I think the idea, lurking as it has on the edges of browser conventions for over a decade, is about to step to the forefront. If it does, it will be because mobile users want their desktop, laptop, and notebook browser displays to function in the same way as their mobile desktops — as a collection of personally selected, icon-based links to sites they use on a regular basis. This will be one of the first instances of mobile browsing conventions effecting a major change in “fixed” computer browsing.</p><p>I firmly believe (without any hard evidence, it must be noted) that sometime in the near future, <strong>desktop/laptop users will want to move to a Speed Dial-like browser interface</strong> that replicates what they have on their mobile devices. I see it as a sea change in browsing: instead of desktop/laptop browsers driving what mobile browsers are able to do, the reverse is going to happen. Instead of the traditional desktop “home page,” users will want a multi-app interface like they use on their phones and tablets.</p><p>If this does happen, then designers/developers who get ahead of the curve will be prepared when the changes come down the pike. We’ll already have our sites, and our clients’ sites, ready to display well in the near-future “desktop app interface” browser facility. (And if it doesn’t happen, we’ll have spent a very small amount of time on the preparation, with no harm to our sites. There really is no downside to this, as you can outfit a website for this new function in less time than it takes the local teenager to deliver you a pizza.)</p><p>So, if I have no hard evidence to show you, how can I convince you? Maybe I can’t. I may well be wrong. But I don’t think so. Years ago, science-fiction writer Robert Heinlein wrote, “It steamboats when it’s steamboat time.” (The historical reference is simple: while inventor Robert Fulton is credited with “inventing” the steamboat, there were a dozen guys on three continents working simultaneously on one variant of the steamboat or the other. Same thing with the telephone; while you and I learned that Alexander Graham Bell “invented” the contraption, there were a lot of guys working on one aspect or the other of voice-driven communication over a wire. It was the proper time in Western society’s technological development for steamboats and telephones; the need was there, and the devices’ creation and dissemination were inevitable.)</p><p><strong>The wave of the future is mobile computing</strong>, and one of the most fundamental aspects of mobile computing is the app-laden desktop. The idea of opening a browser to a single home page is rapidly becoming obsolete, I feel. I started using Speed Dial on my browsers (all of them except IE) over a year ago, and I wouldn’t go back for a plateful of Grandma’s brownies. The usefulness and convenience of having (in the case of my Opera “home page”) 25 “apps” on my desktop as soon as I open my browser precludes me ever going back to a single home page again.</p><p>Still not convinced? Okay, open your desktop browser and stare at whatever home page you’ve chosen. Now flip open your mobile device and look at the array of apps and websites ready to be accessed. Which one gives you more options? Which one feels more modern? More useful? (There are certainly exceptions, particularly companies which require the employee to have the browser set to the company’s or department’s home page, other organizations such as libraries and community centers which have their home pages hard-set, and users who spend so much of their time working on a single site that for them, it wouldn’t make sense to have a “home page” full of icons to different sites when they will always go to the same site first.)</p><h4>The Future Is Now</h4><blockquote><p>[I]n the coming years, more and more websites will have mobile incarnations that look a lot like applications. [P]eople won’t even realize that in the end, the next generation mobile web won. <br />— <a title="Making It a Mobile Web App" href="http://www.smashingmagazine.com/2011/01/26/making-it-a-mobile-web-app/">Kim Pimmel, Smashing Magazine</a></p></blockquote><p>For now, the best way I see to prepare for this predicted oncoming mobile transformation is to combine the requirements of Apple’s touch-screen devices and Opera’s Speed Dial. Apple requires a PNG file of at least 57&#215;57 for conversion to a touch-screen icon. Opera requires an icon at least 114&#215;114. And Opera will recognize Apple’s touch-screen HTML code. I’d say create a PNG icon of 114&#215;114 or larger, not forgetting Opera’s maximum size requirement of 256&#215;160, and use the <code>apple-touch-icon</code> coding:</p><pre class="brush: html">&lt;head&gt;
   &lt;title&gt;Spiffy page with icon for Apple and Opera&lt;/title&gt;
      &lt;link rel="apple-touch-icon" href="http://path/to/appleoperalogo.png"&gt;
&lt;/head&gt;</pre><p>Another viable option is to use two strings of code:</p><pre class="brush: html">&lt;head&gt;
   &lt;title&gt;Spiffy page with icons for Apple and Opera&lt;/title&gt;
      &lt;link rel="apple-touch-icon" href="http://path/to/applelogo.png"&gt;
      &lt;link rel="icon" href="http://path/to/speeddiallogo.png"&gt;
&lt;/head&gt;</pre><p>to ensure full inclusion and forwards compatibility, especially if, as I suspect, Chrome or Firefox will incorporate client-side customization to their own Speed Dial (or dial extensions) in the near future. By doing it this way, you can design separate icons for the touch devices and the browser(s) that take advantage of each one’s individual characteristics.</p><p>The 114&#215;114 icon will be scaled down for different devices. <a href="http://www.devdaily.com/iphone/iphone-app-icon-html-web-app-home-screen-icon" title="Setting an iPhone HTML/web app icon | iPhone app home screen icon">The guys at DevDaily remind us</a> that the iPhone 4 uses the 114&#215;114 icon, whereas older iPhones will scale the icons down to 57&#215;57. An iPad (v1) will scale it down to 72&#215;72. The same 114&#215;114 icon will work perfectly nicely on all these devices. (Bynens <a href="http://mathiasbynens.be/notes/touch-icons" title="Everything you always wanted to know about touch icons">gives some instructions</a> on forcing Apple&rsquo;s iOS4.2 to use multiple icons for different device resolutions, if you&rsquo;re interested.)</p><p>Here’s the proof in that particular pot of pudding: a before-and-after pairing of my site’s icon in Opera’s Speed Dial. For the second go-round, I used the <code>apple-touch-icon</code> coding so that the icon will appear on Apple’s touch-screen devices as well as in Opera’s Speed Dial.</p><p><a href="http://www.smashingmagazine.com/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/oldbmwd.jpg" alt="Oldbmwd in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /> <img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/newbmwd.jpg" alt="Newbmwd in Getting Ahead Of The Curve: Branding On Mobile Devices And Desktop Browsers"  /></a><br /> <em>Comparison of my site’s old and new Speed Dial icons.</em></p><p>The difference is marked. The first icon presents little more than icon gibberish; since I use text and not a graphic as an <code>&lt;h1&gt;</code> site heading in my site, Opera used some of the first graphics it came across (the three icon buttons) and went from there, providing a screen capture that does nothing whatsoever to identify my site as anything of consequence. It took me maybe ten minutes to whip out the new icon in Photoshop, write and insert the code line, and upload it. And that was with the assistance of tabby cats!</p><p>You guys could do it in less, I’m sure. I’m not entirely happy with it; it’s smaller than the bookmark canvas, the corners arent’t rounded, and where the icon canvas is rectangular, the icon itself is square (if the background were white, it wouldn’t matter as much). But whereas the first icon is almost entirely meaningless, the second one <em>conveys</em>.</p><p><strong>Side note</strong>: There are tutorials out there advising us to create icons for Apple devices in Photoshop that include the rounded edges, drop shadows, and &ldquo;gel&rdquo; overlays. Don&rsquo;t do it. Keep the icon edges sharp and don&rsquo;t include the glossy overlays. Apple devices add those effects automatically. The icon I created will have the rounded edges, drop shadow, and glossy appearance on Apple devices. If you want to force Apple to use your own icon without modification, you can use this code:</p><pre class="brush: html">&lt;link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png"&gt;</pre><p>allowing you to add your own effects as you desire.</p><p>Bynens writes: &ldquo;I&rsquo;d recommend to always use precomposed icons. It gives you full control over your icon, and it&rsquo;s the only kind of icon Android 2.1 supports.&rdquo; He also notes that iOS1 and Blackberry&#8217;s OS6 do not support precomposed icons. He gives a somewhat more broad-based, cover-all-your-mobile-bases code snippet, which I&rsquo;ll pass along:</p><pre class="brush: html">&lt;!-- For iPhone 4 with high-resolution Retina display: --&gt;
&lt;link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png"&gt;
&lt;!-- For first-generation iPad: --&gt;
&lt;link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png"&gt;
&lt;!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: --&gt;
&lt;link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png"&gt;</pre><p>Opera 11.10 supports precomposed icons as well as the Apple Touch icons.</p><h3>Conclusion</h3><p>Right now this works on Apple’s touch-screen devices and on Opera’s desktop browser. It’s my educated guess that within a matter of months, it will work on Opera’s Mobile browser and at a later time on the Mini as well. It wouldn’t surprise me if, by this time next year, the code string works on new Speed Dial facilities in Webkit and/or Gecko desktop and mobile browsers (be they actual browser inclusions or extensions). We might even see something of the sort in new IE versions; it’s never smart to count Redmond out. So: take a few minutes, steal a march on the competition, and add the feature to your sites right now. You and your clients will be glad you did.</p><blockquote><p>There is a better way to do it. Find it. — <a title="Thomas A. Edison" href="http://www.mymagneticblog.com/branding-quotes/">Thomas A. Edison</a>, who telephoned when it was telephone time.</p></blockquote><h3>Related Links</h3><ul><li><a title="Designing For The Future Web" href="http://www.smashingmagazine.com/2011/03/29/designing-for-the-future-web/">Designing For The Future Web</a></li><li><a title="Smartphone Browser Landscape" href="http://www.alistapart.com/articles/smartphone-browser-landscape/">Smartphone Browser Landscape</a></li><li><a href="http://mathiasbynens.be/notes/touch-icons" title="Everything you always wanted to know about touch icons">Everything you always wanted to know about touch icons</a></li><li><a href="http://savagelook.com/blog/android/mobile-developers-icon-image-checklist" title="Mobile Developer's Icon and Image Checklist">Mobile Developer&rsquo;s Icon &amp; Image Checklist</a></li><li><a title="A Study of Trends in Mobile Design" href="http://www.smashingmagazine.com/2010/12/02/a-study-of-trends-in-mobile-design/">A Study of Trends in Mobile Design</a></li><li><a title="Mobile Web Design: Best Practices" href="http://sixrevisions.com/web-development/mobile-web-design-best-practices/">Mobile Web Design: Best Practices</a></li><li><a title="Making It a Mobile Web App" href="http://www.smashingmagazine.com/2011/01/26/making-it-a-mobile-web-app/">Making It a Mobile Web App</a></li><li><a title="Mobile Web Design: Is It Worth It?" href="http://sixrevisions.com/web-development/mobile-web-design-is-it-worth-it/">Mobile Web Design: Is It Worth It?</a></li><li><a title="Holistic Web Browsing: Trends Of The Future" href="http://www.smashingmagazine.com/2010/04/10/holistic-web-browsing-4-trends-of-the-future/">Holistic Web Browsing: Trends Of The Future</a></li><li><a title="Apps vs. the Web" href="http://www.alistapart.com/articles/apps-vs-the-web/">Apps vs. the Web</a></li><li><a title="Web Development For The iPhone And iPad: Getting Started" href="http://www.smashingmagazine.com/2010/05/28/web-development-for-the-iphone-and-ipad-getting-started/">Web Development For The iPhone And iPad: Getting Started</a></li><li><a title="How to Use Your iPad for Real Design Work" href="http://sixrevisions.com/tools/how-to-use-ipad-design/">How to Use Your iPad for Real Design Work</a></li><li><a title="How to Make an HTML5 iPhone App" href="http://sixrevisions.com/web-development/html5-iphone-app/">How to Make an HTML5 iPhone App</a></li><li><a title="How To Use CSS3 Media Queries To Create a Mobile Version of Your Website" href="http://www.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/">How To Use CSS3 Media Queries To Create a Mobile Version of Your Website</a></li><li><a title="The State of the Mobile App World" href="http://www.shoutem.com/infographics/make-an-app-big.png">The State of the Mobile App World</a> (infographic)</li></ul><p><em>(vf) (il)</em></p><hr /><p><small>© Michael Tuck for <a href="http://www.smashingmagazine.com">Smashing Magazine</a>, 2011. | <a href="http://www.smashingmagazine.com/2011/05/12/getting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers/">Permalink</a> | <a href="http://www.smashingmagazine.com/2011/05/12/getting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers/#comments">Post a comment</a> | <a href="http://shop.smashingmagazine.com/" title="Smashing Shop">Smashing Shop</a> | <a href="http://www.smashingmagazine.com/the-smashing-network/" title="Smashing Network">Smashing Network</a> | <a href="http://www.smashingmagazine.com/about/" title="About Us">About Us</a><br/> Post tags: <a href="http://www.smashingmagazine.com/tag/branding/" rel="tag">branding</a>, <a href="http://www.smashingmagazine.com/tag/logo/" rel="tag">logo</a>, <a href="http://www.smashingmagazine.com/tag/mobile/" rel="tag">mobile</a>, <a href="http://www.smashingmagazine.com/tag/opera/" rel="tag">Opera</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://www.smashingmagazine.com/2011/05/12/getting-ahead-of-the-curve-branding-on-mobile-devices-and-desktop-browsers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design a forest inspired Tumblr theme in Photoshop</title>
		<link>http://www.webdesignerdepot.com/2011/05/design-a-forest-inspired-tumblr-theme-in-photoshop/</link>
		<comments>http://www.webdesignerdepot.com/2011/05/design-a-forest-inspired-tumblr-theme-in-photoshop/#comments</comments>
		<pubDate>Thu, 12 May 2011 11:30:13 +0000</pubDate>
		<dc:creator>Walter</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.webdesignerdepot.com/?p=23104</guid>
		<description><![CDATA[<a
href='http://rss.buysellads.com/click.php?z=1259940&#038;k=75e07a75487088b1694a6868e9c95d21&#038;a=23104&#038;c=552627522' target='_blank'><img
src='http://rss.buysellads.com/img.php?z=1259940&#038;k=75e07a75487088b1694a6868e9c95d21&#038;a=23104&#038;c=552627522' border='0' alt='' /></a><p><a
href='http://buysellads.com/buy/sitedetails/pubkey/75e07a75487088b1694a6868e9c95d21/zone/1259940' target='_blank'>Advertise here with BSA</a></p><br
/>Tumblr is a micro-blogging platform that allows users to easily publish snippets of information to the web, such as a photo or photo set, a video, a quote or just a paragraph. It is often used as an online diary because of to its ease of use compared to other blogging platforms such as WordPress. [...]]]></description>
			<content:encoded><![CDATA[<a
href='http://rss.buysellads.com/click.php?z=1259940&k=75e07a75487088b1694a6868e9c95d21&a=23104&c=1147686124' ><img
src='http://rss.buysellads.com/img.php?z=1259940&k=75e07a75487088b1694a6868e9c95d21&a=23104&c=1147686124' border='0' alt='' /></a><p><a
href='http://buysellads.com/buy/sitedetails/pubkey/75e07a75487088b1694a6868e9c95d21/zone/1259940' >Advertise here with BSA</a></p><br
/><p><a
href="http://netdna.webdesignerdepot.com/uploads/2011/04/thumb10.jpg"><img
class="alignleft size-full wp-image-23106" title="thumb" src="http://netdna.webdesignerdepot.com/uploads/2011/04/thumb10.jpg" alt="" width="200" height="160" /></a><strong>Tumblr</strong> is a micro-blogging platform that allows users to easily  publish snippets of information to the web, such as a photo or photo  set, a video, a quote or just a paragraph.</p><p>It is often used as an online  diary because of to its ease of use compared to other blogging  platforms such as WordPress.</p><p>A lot of Tumblr themes are out there, both free and premium, but have you ever wondered how you’d go about designing your own?</p><p>In this tutorial, you’ll learn how to create a forest-inspired Tumblr  theme, making use of wood textures, subtle patterns and modern  techniques—a nice blend of natural and modern elements.<span
id="more-23104"></span></p><h1>What we’re going to design</h1><p>The theme we’ll be designing in Photoshop consists of four areas: wooden sidebar, main content area, right sidebar and header.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/70.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 1</h1><p>The first step, as should be with all things you design, is the  sketching stage. Using my Wacom Bamboo graphics tablet and a blank  canvas in Photoshop, I sketched the following design, with some larger  elements, just to get my ideas down on (digital) paper.</p><p><img
class="image-border" src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/01.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 2</h1><p>With the idea roughed out, create a new document in Photoshop. (Keep  in mind, this isn’t set in stone. It’s just something you can refer back  to if you get stuck in the design. Personally, I tend to experiment and  change a lot of what I initially planned.) I used the following  settings in Photoshop:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/02.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 3</h1><p>The next stage is to put some guides down on the canvas. This will  help you keep the structure of the theme neat as you design it. I want  the left sidebar to be 200 pixels, the main content area to be 600  pixels and the right sidebar to be 160 pixels, giving us a width of 960  pixels.</p><p>If you’ve used the same settings, you can place your guides at 200,  800 and 960 pixels horizontally. This design will be aligned left, so  that the wooden sidebar always sits against the left side of the user’s  viewport.</p><p><img
class="image-border" src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/03.jpg" alt="" width="615" /></p><p>I also placed guides 200 pixels below the top of the canvas and 200  pixels above the bottom of the canvas. This is how my document currently  looks:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/04.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 4</h1><p>Let’s now add some pattern to our background. Go to File → New, and  create a new document that’s 8 × 8 pixels. Draw some vertical lines with  a width of 2 pixels. Your canvas should now be 2 pixels black, 2 pixels  white, 2 pixels black, 2 pixels white. Go to Edit → Define Pattern.  Save your pattern as “Vertical Lines 2px.”</p><p>In your original document, go to Layer → New Fill Layer → Pattern.  Select the pattern you just created, and click OK. Drop the opacity of  the layer until it looks something like this:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/05.jpg" alt="" width="615" /></p><p>Merge the pattern with your background layer, automatically  rasterizing it in the process. Go to Filter → Noise → Add Noise. Change  the value to 5% and click OK. This will add some subtle texture to the  background:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/06.jpg" alt="" width="615" /></p><p>Create a new layer, and fill it with white. Position it beneath the  original background layer. Lower the opacity of your textured layer  pattern to around 40%, and then merge it with the background layer by  going to Layer → Merge Layers.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/07.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 5</h1><p>Select the Rectangle tool, and draw a shape that’s 200 pixels wide.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/08.jpg" alt="" width="615" /></p><p>We’re going to slice off the bottom of our shape using the Polygonal  Lasso tool, making it look like a ribbon. Create a selection over your  shape, rasterize the shape layer, and then hit the Delete key to remove  the selected area.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/09.jpg" alt="" width="615" /></p><p>Place the shape in the left sidebar area that we marked using our guides.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/10.jpg" alt="" width="615" /></p><p>Create a selection of the top portion of the shape, and go to Edit →  Free Transform. Stretch the shape so that it overlaps with the top line  of the canvas.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/11.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 6</h1><p>Select the Ellipse Shape tool and, while holding the Shift key to  keep it round, draw a circle, filled with white. Position it at the top  of the sidebar, and rename the layer to “Portrait.”</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/12.jpg" alt="" width="615" /></p><p>Right-click on the new shape layer, and select the “Rasterize layer”  option to turn it from a smart object into pixels. Hold down the Command  key, and click on the layer’s preview image in the Layers panel. This  will make a selection of your circle.</p><p>Locate a picture of yourself (or whatever your website is about) and  copy it. Head back into Photoshop and, with the circle selection still  active, go to Edit → Paste Into. This will paste the object in your  circle selection.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/13.jpg" alt="" width="615" /></p><p>Having done this, you have automatically created a layer mask on the  image (i.e. on a new layer, not the existing circle layer). Go to Edit →  Free Transform to resize and/or rotate the image. It will remain a  circle; just be sure not to make it too small. Once that’s done, delete  the layer named “Portrait,” and rename your new layer.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/14.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 7</h1><p>Select the Type tool, and create a text box in the header area. I’ve  given my theme a completely random name: “Kabooom.” I used a font called  Reklame Script. You can download a demo of the font or purchase it for  $30 from <a
href="http://new.myfonts.com/fonts/hvdfonts/reklame-script/">MyFonts</a>.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/15.jpg" alt="" width="615" /></p><p>Right-click on your type layer, and select “Blending Options.” Apply a  color overlay to the text. I used a light gray that’s a little darker  than the background, with the hex code #D6D6D6.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/16.jpg" alt="" width="615" /></p><p>Apply an inner shadow to the type, using an opacity of 10%, a  distance of 2 pixels and a size of 1 pixel. Leave everything else at 0.  This will make the type look like it was engraved in the background.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/17.jpg" alt="" width="615" /></p><p>To complete the engraved effect, we’ll add a drop shadow to the type,  using the color white with a normal blending mode. Give the shadow a  distance of 2 pixels and a size of 1 pixel. These settings will make the  shadow appear as a highlight at the bottom of the type, adding more  depth to the type and reinforcing the inner shadow.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/18.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 8</h1><p>Reselect the Type tool, and create a text box that fills the width of  the right sidebar, which we have marked with guides. Put a variety of  categories under the category heading, as seen below:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/19.jpg" alt="" width="615" /></p><p>Select the category heading, and change the typeface to one of your  choice. I used Minion Pro. Experiment with sub-fonts (bold, italic,  etc.) and point sizes.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/20.jpg" alt="" width="615" /></p><p>Change the font for the categories (“News,” “Days out,”  “Photography,” etc.) I used Myriad Pro. Lower the point size of the  type, and adjust the leading (i.e. the space between the lines of text),  so that the top line sits lower than where it is by default.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/21.jpg" alt="" width="615" /></p><p>Copy the first heading and the links and paste them below in the same  text box. Change the heading and categories. I used the headings “My  Projects” and “My Friends.” Use whatever is relevant to your website, of  course.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/22.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 9</h1><p>We’re now going to make the text in the right sidebar a little more  appealing. Select the text for sub-categories (i.e. not the headings),  and change the color from black to a dark gray. I used #333333. Click  OK.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/23.jpg" alt="" width="615" /></p><p>Right-click on the type layer, and select “Blending options.” Apply a  white drop shadow with a normal blending mode. Change the angle to 120°  and the distance and size to 1 pixel. Leave everything else set to 0  pixels. This will add a highlight to the bottom of the text, just like  we did with the heading.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/24.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 10</h1><p>Select the Line tool and, while holding the Shift key to keep it straight, draw a line beneath the “Categories” heading.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/25.jpg" alt="" width="615" /></p><p>Right-click on the line layer, and select “Blending options.” Apply a  white drop shadow with a normal blending mode. Set the angle to 90° and  the distance to 1 pixel. Set everything else to 0 pixels.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/26.jpg" alt="" width="615" /></p><p>Duplicate the line layer, and position it below each of the headings.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/27.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 11</h1><p>If you have the same number of headings as me, then you should have  three line layers. Select them all, and duplicate them. With the three  line layers still selected, nudge them down 10 pixels by holding the  Shift key and pressing the Down key once. Lower the opacity of your  newer line layers to 25% to end up with something like this:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/28.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 12</h1><p>Grab the Rectangle Shape tool, and draw a rectangle similar to what’s  below. Make the rectangle exactly 570 pixels wide. This will allow for a  10-pixel gap between the left sidebar and the edge of the new rectangle  and a 20-pixel gap between the right sidebar and the edge of the new  rectangle, as seen in the annotated screenshot below:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/29.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 13</h1><p>Reselect the Rectangle Shape tool and create a much smaller gray  rectangle, like the one below. Position it in the top-right of the large  rectangle, offset from the large rectangle by 10 pixels. Position the  shape 30 pixels away from the top of the rectangle.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/30.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 14</h1><p>Duplicate the type layer in the right sidebar and, using the Shift  key and Cursor key combination, nudge the duplicated type layer over the  main content area. Do the same with the two line layers for your  “Categories” heading.</p><p>Select the Type tool, and click on your duplicated type layer. Remove  all of the text in the box, and change the heading to something more  suitable. I just used some dummy text here: “This right here is called a  title.”</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/31.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 15</h1><p>Go to File → Place, and locate a photograph to place in the document  as a placeholder. Using real images here is always best because they  make the mock-up seem more real and attractive. I used a <a
href="http://www.flickr.com/photos/callumchapman/5128891644/in/set-72157619968980287/">photo of my sister</a>.</p><p>Go to Edit → Free Transform to reduce the size of the photo and  position it in the right spot. Make it a total of 20 pixels shorter in  both width and height so that it fits nicely in the black rectangle,  like so:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/32.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 16</h1><p>Open up the Blending options for the large black rectangle. Apply a  white color overlay and a drop shadow with an opacity of 10% and a size  of 3 pixels.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/33.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 17</h1><p>Select the Rectangle Shape tool once again, and draw a long shape  below the white photo background shape. Make sure it is the same width.  Fill it with a light gray.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/34.jpg" alt="" width="615" /></p><p>Open the Blending options for the new gray rectangle, and apply a  drop shadow. Set the color to white, with a normal blending mode, the  opacity to 100% and the distance to 1 pixel. Leave everything else set  to 0 pixels.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/35.jpg" alt="" width="615" /></p><p>Also, apply an inner shadow, using the color black, with an opacity  of 10%. Change the size to 13 pixels, and leave everything else set to 0  pixels. These two layer styles will make the new shape look like it was  etched in the background, like our heading typography:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/36.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 18</h1><p>Moving on to the sidebar, download some repeating wood textures. I’m using a <a
href="http://graphicriver.net/item/3-tileable-bamboo-textures/112983">set from GraphicRiver</a> that includes three different wood textures: light, medium and dark.</p><p>Once you’ve installed the patterns in Photoshop (by opening each  image and defining it as a pattern), select the sidebar in your  Photoshop document. Go to Layer → New Fill Layer → Pattern. Select one  of your wood textures (I selected the medium version), and click OK. By  selecting the sidebar first, the pattern should fill only that area.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/37.jpg" alt="" width="615" /></p><p>Right-click on the pattern layer, and select “Blending options.”  Apply a gradient overlay, going from black to transparent to black:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/38.jpg" alt="" width="615" /></p><p>Change the opacity of the gradient overlay to 10%, and give it an  angle of 0°. This will add a subtle shadow to the sidebar, making it  appear a little more realistic and less flat.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/39.jpg" alt="" width="615" /></p><p>Also, apply a drop shadow to the sidebar. Lower the opacity to 30%,  and change the angle to 180°. Change the distance to 1 pixels and the  size to 5 pixels, leaving everything else set to 0 pixels. This will add  a small and subtle shadow to the sidebar.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/40.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 19</h1><p>Open up the “Blending options” for the circle portrait that we  created near the beginning of this tutorial. Apply a white drop shadow  using the settings below:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/41.jpg" alt="" width="615" /></p><p>Also, apply an inner shadow using the settings below. This will make  the circle portrait look as if it was placed in the tree, rather than  just sitting on it.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/42.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 20</h1><p>Duplicate the title layer in the main contents. Reposition it to the  sidebar, and change the text to “About me.” Also, reposition and resize  the two lines below the heading.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/43.jpg" alt="" width="615" /></p><p>Open the “Blending options” for your new type layer, and change the drop-shadow settings to these:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/44.jpg" alt="" width="615" /></p><p>Add some text to the “About me” section, using the same font and size  that we used in the right sidebar text. Open the “Blending options” for  this new text, and click on the “Outer glow” tab to apply an outer  glow; change the opacity to 30%, the color to white and the size to 18  pixels.</p><p>This will make our text more readable against the wooden background.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/45.jpg" alt="" width="615" /></p><p>Play around with the font size to make the text easier to scan.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/46.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 21</h1><p>After some experimentation, I decided that the whole sidebar looked  much better in the darker of the three textures mentioned above. I  changed the sidebar pattern and the colors of the text. Use the  techniques you have already learned to do this.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/47.jpg" alt="" width="615" /></p><p>Here is what my design looks like so far:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/48.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 22</h1><p>However much you have planned, you’re bound to make changes during  the design process. Upon looking at the design as a whole (rather than  piecemeal), I concluded that 10 pixels between the sidebars and main  content area was nowhere near enough.</p><p>Using the Shift key and Cursor key combination, nudge your content  across, making the two gaps 40 pixels instead of 10. This will make the  design more usable and attractive.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/49.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 23</h1><p>I also decided to change the style of the theme’s header.</p><p>Change the color (using a color overlay in the “Blending options”  window) to one selected from the circle portrait. I picked a dark  green-blue.</p><p>I also removed the inner shadow and changed the drop-shadow settings,  making it look like the header is sitting above the background rather  than set into it.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/50.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 24</h1><p>Moving on to the main content banner (i.e. the rectangle we created  earlier that sits in the top-right corner of our main content’s image  area), select the rectangle by clicking on the layer’s thumbnail preview  while holding the Command key.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/51.jpg" alt="" width="615" /></p><p>Go to Layer → New Fill Layer → Pattern, and select the same texture you used for the sidebar.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/52.jpg" alt="" width="615" /></p><p>Right-click on the pattern fill layer, and select the “Rasterize  layer” option. Using the Dodge and Burn tools, add highlights to the  left and top of the shape and shadows to the right and bottom of the  shape.</p><p>This will add depth and give a slight three-dimensional feel to the  shape. The Burn tool will darken the image, whereas the Dodge tool will  lighten it.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/53.jpg" alt="" width="615" /></p><p>Select the Polygonal Lasso tool. Select a shape similar to the one  below, and fill it with a dark brown, selected from your texture.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/54.jpg" alt="" width="615" /></p><p>Using the Rectangular Marquee tool, select the areas in the new shape  that you don’t need, and hit the Delete key to remove them. You should  end up with something similar to this:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/55.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 25</h1><p>Grab our very own <a
href="http://www.webdesignerdepot.com/2011/05/2010/07/200-exclusive-free-icons-reflection/">exclusive icon set</a> called “Reflection.” We will use several of these icons in our design.</p><p>Insert the icons that you need in the document by going to File →  Place. I chose the camera, heart, reload, edit and clock icons, which  will serve as my photo, like, reblog, notes and time icons in the theme.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/56.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 26</h1><p>Select the camera icon and resize it. Position it on the post type  bar that we just created. Apply an inner and drop shadow to it, using  settings similar to those we have been using throughout this tutorial.</p><p>Add some typography to the post type bar. I used the same Reklame  Script that we used in the heading and the same blending options that we  used for the left sidebar headings.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/57.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 27</h1><p>Select the other four icon layers. Right-click, and select “Rasterize layers” to turn them from smart objects to pixel objects.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/58.jpg" alt="" width="615" /></p><p>Use the Rectangular Marquee tool to select all of the icon’s reflections.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/59.jpg" alt="" width="615" /></p><p>Hit the Delete key on each of the icon layers to remove its reflection.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/60.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 28</h1><p>Reselect all four icon layers. Go to Edit → Free Transform and, while  holding the Shift key to keep the icons in proportion, reduce their  size, and position them on the bar below the main content area that we  created earlier.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/61.jpg" alt="" width="615" /></p><p>Space out the icons evenly using the cursor keys.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/62.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 29</h1><p>Right-click on the heart icon layer, and select “Blending options”  from the menu. Change the color to light gray using a color overlay, and  apply an inner shadow using the following settings:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/63.jpg" alt="" width="615" /></p><p>Now apply a drop shadow, using these settings:</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/64.jpg" alt="" width="615" /></p><p>Once the settings have been applied to the heart icon layer,  right-click and select “Copy layer styles.” Reselect all four icons,  right-click and select “Paste layer styles.” All of the icons in this  bar should now have the same effect.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/65.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 30</h1><p>Select the Type tool, and make a small text box next to the heart  icon. Type “Like this post.” Apply an inner shadow and drop shadow using  settings similar to those we have been using throughout this tutorial.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/66.jpg" alt="" width="615" /></p><p>Repeat the previous step for the remaining icons, using the following  phrases: “Reblog this post,” “1052 notes” and “Posted on 19/03/2011.”  Be sure to copy and paste the same layer style onto each type layer.</p><p>You may also want to reposition some of the icons with the new text,  making sure that the gap between the text and icons is consistent;  because of the different text lengths, this may have changed.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/67.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 31</h1><p>Duplicate all of the layers in the main content area, and position  them below the original. Change the title, image and post type  rectangle. As mentioned, the more realistic the mock-up, the better.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/68.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>Step 32</h1><p>Duplicate the heading and text in the sidebar, and insert some icons. I used the excellent social media icons known as <a
href="http://www.webdesignerdepot.com/2011/05/2010/08/buddycons-vector-social-media-icons/">Buddycons</a>, another set exclusive to Webdesigner Depot.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/69.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><h1>The final product</h1><p>After some more touch-ups (I removed the jagged ribbon-like cut at  the bottom of the sidebar), I’m all done! Here is our final design,  ready to be coded or sent off to a developer to do it.</p><p><img
src="http://netdna.webdesignerdepot.com/uploads/kaboooom_tut/70.jpg" alt="" width="615" /></p><p><br
class="spacer_" /></p><p><em>This tutorial was put together exclusively for Webdesigner Depot by <a
href="http://twitter.com/callumchapman">Callum Chapman</a>, a freelance user interface designer trading under the name <a
href="http://circleboxcreative.com/">Circlebox Creative</a>. Callum is also working on an <a
href="http://vinspires.com/">inspiration gallery</a> project called Vinspires.</em></p><p><em><strong>Would you like to see another tutorial on how to slice and code this design into a fully working Tumblr theme?</strong></em></p><style></style><p><br/>If you find an exclusive RSS freebie on this feed or on the live WDD website, please use the following code to download it: O1Rs1S</p><p><br/><br
/><table
width="100%" style="border-top:1px solid #d7d7d7; border-bottom:1px solid #d7d7d7;" height="20"><tr><td
valign="center"> <a
href="http://mightydeals.com/deal/visualfreaks.html?ref=inwidget"><font
face="Arial" size="3" color="#e64f32"><b>Get 4 VisualFreaks Packs for only $29.95 (reg. $119)</b></font></a></td><td
width="90"> <a
href="http://www.mightydeals.com/?ref=inwidget"><br
/> <img
src="http://mightydeals.com/web/images/widget-logo.png" height="40" width="90" border="0"  /><br
/> </a></td></tr></table><p><br/></p> <a
href="http://www.webdesignerdepot.com/2011/05/design-a-forest-inspired-tumblr-theme-in-photoshop/">Source</a><style type="text/css">p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}</style>
<p><a href="http://feedads.g.doubleclick.net/~a/IsA3qA1ndhPUym1Pd3THKSqgOYk/0/da"><img src="http://feedads.g.doubleclick.net/~a/IsA3qA1ndhPUym1Pd3THKSqgOYk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/IsA3qA1ndhPUym1Pd3THKSqgOYk/1/da"><img src="http://feedads.g.doubleclick.net/~a/IsA3qA1ndhPUym1Pd3THKSqgOYk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/webdesignerdepot/~4/Sbyz7Gerhus" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webdesignerdepot.com/2011/05/design-a-forest-inspired-tumblr-theme-in-photoshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Work with PHP and FTP</title>
		<link>http://feedproxy.google.com/~r/nettuts/~3/WByxTJf6JUc/</link>
		<comments>http://feedproxy.google.com/~r/nettuts/~3/WByxTJf6JUc/#comments</comments>
		<pubDate>Thu, 12 May 2011 00:26:09 +0000</pubDate>
		<dc:creator>Jarrod Oberto</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=20012</guid>
		<description><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=20012&#038;c=984586392' target='_blank'><img src='http://rss.buysellads.com/img.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=20012&#038;c=984586392' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' target='_blank'>Advertise here</a></p><p>In this tutorial, our goal is to create an FTP class with PHP that is well written, useful, and expandable.</p>
<p><span id="more-20012"></span></p>
<h3> Outlining our Objective </h3>
<p>It&#8217;s always important to first outline exactly what functionality your class should include. In our case:</p>
<ul>
<li>connecting to a server</li>
<li>create a folder on the server</li>
<li>upload a file</li>
<li>change directory</li>
<li>retrieving the directory listing</li>
<li>download a file</li>
</ul>
<h3> When Would I Use an FTP Class? </h3>
<p> There are several instances when one might use this sort of class. A couple of scenarios could be:</p>
<ul>
<li>Automate uploading of images, such as a gallery, to a client&#8217;s website (ideally, in conjunction with my image <a href="http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/">resizing tut</a>)</li>
<li>Perform off-site backups by transferring a database backup file from your server to another. (<em>Note: This isn&#8217;t recommended for sensitive information as FTP is not a very secure protocol.</em>)</li>
</ul>
<blockquote>
<p><strong>Note:</strong> It&#8217;s easy to run into issues with FTP due to different server configurations. This code has been tested on a number of FTP servers successfully.</p>
</blockquote>
<hr />
<h2>What is FTP?</h2>
<blockquote class="pullquote">
<p>
<strong>FTP:</strong> &#8220;A standard network protocol used to copy a file from one host to another.&#8221;
</p>
</blockquote>
<p>FTP, or File Transfer Protocol, is, as defined by Wikipedia: &#8220;A standard network protocol used to copy a file from one host to another over a TCP/IP-based network, such as the Internet.&#8221; </p>
<p>Essentially, it allows you to copy a file(s) from one computer to another.</p>
<hr />
<h2><span>Step 1</span> &#8211; Preparation</h2>
<p>We&#8217;ll start off as easy as possible. In your new project&#8217;s root, create two files: <code>index.php</code> and <code>ftp_class.php</code>.</p>
<p>The <code>index.php</code> file is our main page that creates the object and calls the necessary methods. The <code>ftp_class.php</code> is just that: our ftp class.</p>
<p>In the next step, we&#8217;re going to create the skeleton for our class. Once this is in place, you&#8217;ll be able to follow along and try each step. </p>
<div class="tutorial_image"><img src="http://d2o0t5hpnwv4c1.cloudfront.net/978_ftp/ftp-1.png" border="0" /></div>
<hr />
<h2><span>Step 2</span> &#8211; Setting up the Class</h2>
<p>The strength of Object-Oriented Programming (OOP) is to give complex code an easy to use interface. By creating a class &#8212; think of a class as a pattern &#8212; you can encapsulate the data, which is simply jargon for a term that refers to hiding the data. We can then reuse this class over and over without the need to rewrite any of the code. Instead, you only need to call the appropriate methods (the term &#8220;<code>method</code>&#8221; is the same as <code>function</code>).</p>
<p>Let&#8217;s begin creating our ftp class. Open your <code>ftp_class.php</code> file, and add the following code. This is a basic class skeleton structure, which I&#8217;ve named &#8216;<code>FTPClient</code>&#8216;.</p>
<p>The <code>construct</code> function, known as a constructor, is a special class method that is automatically called by the class when you create a new object, or instance of the class. This is typically a good place to add some initialization; but for today&#8217;s purpose, we don&#8217;t need it. Nonetheless, we&#8217;ll keep it here for future use.</p>
<pre name="code" class="php">
	Class FTPClient
	{
		// *** Class variables

		public function __construct() {	}
	}
</pre>
<p>Please note that we&#8217;re using a  <strong>double</strong> underscore for that <code>construct</code> method.</p>
<hr />
<h2><span>Step 3</span> &#8211; Class Variables</h2>
<p>Next, we&#8217;ll set set some class variables, or properties. </p>
<pre name="code" class="php">
	private $connectionId;
	private $loginOk = false;
	private $messageArray = array();
</pre>
<p>The &#8220;<code>private</code>&#8221; prefix defines the scope of the variable. In this case, it means that the variable can&#8217;t be accessed from anywhere outside of the class.</p>
<p>The <code>$connectionId</code> variable will store our connection stream. The other two store the status and any messages. <code>$loginOk</code> will be useful when determining if we&#8217;re properly connected.</p>
<hr />
<h2><span>Step 4</span> &#8211; Simple Message Logging</h2>
<p> In nearly every method, we&#8217;re going to call a method, named &#8216;<code>logMessage</code>. This is a very basic message handler, that will allow us to capture any messages created by our class so that we can provide the user with feedback. </p>
<blockquote>
<p>Note that we don&#8217;t <code>return</code> the actual messages from within our methods. Instead, we return <code>true</code> or <code>false</code>, based upon whether or not a particular operation was successful. This has its advantages, but also doesn&#8217;t detail to the user what&#8217;s happening.</p>
</blockquote>
<p>Add the following two methods, so we can determine what&#8217;s successful.</p>
<p>This method accepts a variable, <code>$message</code>. The contents of this variable are then saved into our class array, thanks to the line: <code>$this->messageArray[] = $message;</code></p>
<pre name="code" class="php">
	private function logMessage($message)
	{
		$this->messageArray[] = $message;
	}
</pre>
<p>Because <code>$messageArray</code> is a class variable, we can access it, via the <code>$this-></code> notation. </p>
<blockquote>
<p>Within a class, <code>$this</code> refers to the object itself.</p>
</blockquote>
<p>To retrieve the message, we call <code>getMessages</code>.</p>
<pre name="code" class="php">
	public function getMessages()
	{
		return $this->messageArray;
	}
</pre>
<p>This method is a public method. As mention previously, this private/public business simply refers to the scope of the variable, or in this case, the method. A private method (or variable) cannot be accessed outside of the class, while a public method (or variable) can.  </p>
<p>Because our variable is private, we need a way to access it. We do this by giving our class a <code>public</code> method, which we can then access outside of the class. You might wonder why we can&#8217;t simply make the <code>messageArray</code> variable public. We can; that said, it&#8217;s just not a good practice.</p>
<p><strong>Note:</strong> There are plenty examples around the web of full blown message handlers, or classes dedicated to them. We&#8217;re working on a simple implementation for the purpose of this tutorial.</p>
<hr />
<h2><span>Step 5</span> &#8211; Connecting</h2>
<p>In this step, we&#8217;ll add the <code>connect</code> method. This will allow us to connect to an FTP server.</p>
<pre name="code" class="php">
	public function connect ($server, $ftpUser, $ftpPassword, $isPassive = false)
	{

		// *** Set up basic connection
		$this->connectionId = ftp_connect($server);

		// *** Login with username and password
		$loginResult = ftp_login($this->connectionId, $ftpUser, $ftpPassword);

		// *** Sets passive mode on/off (default off)
		ftp_pasv($this->connectionId, $isPassive);

		// *** Check connection
		if ((!$this->connectionId) &#124;&#124; (!$loginResult)) {
			$this->logMessage('FTP connection has failed!');
			$this->logMessage('Attempted to connect to ' . $server . ' for user ' . $ftpUser, true);
			return false;
		} else {
			$this->logMessage('Connected to ' . $server . ', for user ' . $ftpUser);
			$this->loginOk = true;
			return true;
		}
	}
</pre>
<p>We pass in our connection information: the server (<code>$server</code>), username (<code>$ftpUser</code>), and password (<code>$ftpPassword</code>) to allow us to establish a connection. </p>
<p>
The first line of code opens an FTP connection, with <code>ftp_connect</code>, to the specified server. We save our connection to the class variable, <code>$connectionId</code> described above.</p>
<p>The code, <code>ftp_login</code> logs us in to the specified connection, passing in our <code>connection id</code>, our username, and password.</p>
<p>You might have noticed the <code>ftp_pasv</code> line of code. This, as the comment implies, turns on/off passive mode. I&#8217;d suggest you leave it off, however, if you have any issues connecting, try turning it on. Passive mode can cause a bit of a mare when connecting via FTP.</p>
<p>We determine if the connection was successful. We then log the results by calling our simple message handler method, <code>logMessage()</code>, and pass the string to log. Remember: we use <code>$this-></code> to access <code>logMessage()</code>, as it is a class variable. </p>
<hr />
<h2><span>Step 6</span> &#8211; Calling the Object</h2>
<p>Now that our class is working, we can test it out! Open your <code>index.php</code> file, and add the following code. </p>
<blockquote>
<p>You&#8217;ll need access to an FTP server to play along. If you wish to set your own server up, try <a href="http://filezilla-project.org/download.php?type=server">Filezilla</a> &#8211; it&#8217;s free, too.</p>
</blockquote>
<p>You&#8217;ll notice I&#8217;ve added the FTP server details here. Ideally these would be stored within your <code>config</code> file. Change these to match the settings of your FTP server.</p>
<p>After defining our FTP server details, we include the class with <code>include('ftp_class.php');</code>. This means: make the class available from within this page. The next line creates an object of our FTP class, and stores it in the variable, <code>$ftpObj</code>. <code>$ftpObj</code> will now be used to access any public methods within our class. This is done by using the <code>-></code> notation, just like the following line does by calling the <code>$ftpObj -> connect</code> method and passing it our server details.</p>
<pre name="code" class="php">
		// *** Define your host, username, and password
		define('FTP_HOST', '192.168.1.88');
		define('FTP_USER', 'Blimpf');
		define('FTP_PASS', 'catfish');

		// *** Include the class
		include('ftp_class.php');

		// *** Create the FTP object
		$ftpObj = new FTPClient();

		// *** Connect
		$ftpObj -> connect(FTP_HOST, FTP_USER, FTP_PASS);
</pre>
<p>As you can see, once our class is in place, connecting to our FTP server is really quite easy!</p>
<hr />
<h2><span>Step 6b</span> &#8211; Viewing the Output</h2>
<p>In the last step we could wrap the connect call in an <code>if</code> statement, as demonstrated below. Then, if we fail to connect, the dependent code won&#8217;t be executed. We can then output any messages to the user,  such as &#8220;connected&#8221; or &#8220;failed&#8221;.</p>
<pre name="code" class="php">
		// *** Connect
		if ($ftpObj -> connect(FTP_HOST, FTP_USER, FTP_PASS)) {

			// *** Then add FTP code here

			echo 'connected';

		} else {
			echo 'Failed to connect';
		}
</pre>
<p>This is okay, though our code will quickly become rather bloated with IF/ELSE statements, if we add this to all our calls. Instead, I&#8217;d like to offer an alternative that will make things a bit cleaner and easier to follow. </p>
<p>Remember the message handler methods we added? If you wish to see the messages produced by the class &#8211; helpful for debugging/feedback &#8211; you can add the following code after any method that you call.</p>
<pre name="code" class="php">
		print_r($ftpObj -> getMessages());
</pre>
<p>This will display the class message.</p>
<hr />
<h2><span>Step 7</span> &#8211; Making our First Directory</h2>
<p>Excellent, now it&#8217;s time to do something useful. The first method we&#8217;re going to create is the <code>makeDir</code> method. As expected, this method will create directories for us on the server. The only parameter we will pass is the directory path and folder name; we&#8217;ll call it <code>$directory</code>. The magical line here is the <code>ftp_mkdir</code> built-in function. It uses our saved &#8220;<code>connectionId</code>&#8221; and the passed in <code>$directory</code> variable to create the folder. </p>
<p>Add the following code to your <code>ftp_class.php</code> file:</p>
<pre name="code" class="php">
		public function makeDir($directory)
		{
			// *** If creating a directory is successful...
			if (ftp_mkdir($this->connectionId, $directory)) {

				$this->logMessage('Directory "' . $directory . '" created successfully');
				return true;

			} else {

				// *** ...Else, FAIL.
				$this->logMessage('Failed creating directory "' . $directory . '"');
				return false;
			}
		}
</pre>
<p>And, to call it from your <code>index.php</code> file, add:</p>
<pre name="code" class="php">
		$dir = 'photos';	

		// *** Make directory
		$ftpObj->makeDir($dir);
</pre>
<p>The variable, <code>$dir</code> is set to the name of the folder we want to create on the server. In this case: &#8220;photos&#8221;.</p>
<p>The next line calls the method that will create the folder.</p>
<blockquote>
<p>If you receive a &#8220;Permission denied&#8221; error, make sure that you can write in the folder specified. You might need to create the folder within a directory, such as <code>/httpdocs</code>. </p>
</blockquote>
<hr />
<h2><span>Step 8</span> &#8211; Uploading a File</h2>
<p>Continuing on, let&#8217;s upload a photo, called <code>zoe.jpg</code>. When uploading a file, we need to specify what type of file we&#8217;re uploading &#8211; <code>binary</code> or <code>ascii</code>? Basically, if you&#8217;re uploading a text file, we should use <code>ascii</code>; otherwise, it should be set to binary.</p>
<p> We begin by setting up an <code>array</code> with all the extensions that we should use for an <code>ascii</code> type upload.</p>
<pre name="code" class="php">
$asciiArray = array('txt', 'csv');
</pre>
</p>
<p> Then, we retrieve the extension of our file, so we can test if it is one of the <code>ascii</code> types. We determine this by getting the extension of the file we&#8217;re uploading. The quick and dirty method I have used here is<br />
by &#8220;<a href="http://php.net/manual/en/function.explode.php">exploding</a>&#8221; the file using the &#8216;<code>.</code>&#8216; as the delimiter. This will split the file into pieces, and store them as an <code>array</code>. Using another built-in PHP function, &#8220;<a href="http://php.net/manual/en/function.end.php">end</a>&#8220;, we select the last <code>array</code> element that contains our extension. It&#8217;s a tidy little bit of code.
</p>
<pre name="code" class="php">
$extension = end(explode('.', $fileFrom));
</pre>
<p>Next, we test if our extension appears in the list (with <a href="http://nz.php.net/manual/en/function.in-array.php">in_array</a>) of file extensions that should be uploaded as type <code>ascii</code>. If it appears in the list, we set the variable <code>$mode</code> to <code>FTP_ASCII</code>; otherwise, we assume it&#8217;s of binary type, and assign <code>$mode</code> the value <code>FTP_BINARY</code>.</p>
<pre name="code" class="php">
in_array($extension, $asciiArray)
</pre>
<p><code>ftp_put</code> uploads a file from your local location to a remote file on the ftp server. We pass it our &#8220;<code>connectionId</code>&#8220;, the path to the file we want to upload to (<code>$fileTo</code>), the path<br />
of the file we want to upload (<code>$fileFrom</code>), and the mode (<code>$mode</code>) which we&#8217;ve just determined.</p>
<div class="tutorial_image"><img src="http://d2o0t5hpnwv4c1.cloudfront.net/978_ftp/zoe.jpg" border="0" /></div>
<p>Next, add the following method to your <code>ftp_class.php</code> file:</p>
<pre name="code" class="php">
	public function uploadFile ($fileFrom, $fileTo)
	{
		// *** Set the transfer mode
		$asciiArray = array('txt', 'csv');
		$extension = end(explode('.', $fileFrom));
		if (in_array($extension, $asciiArray)) {
			$mode = FTP_ASCII;
		} else {
			$mode = FTP_BINARY;
		}

		// *** Upload the file
		$upload = ftp_put($this->connectionId, $fileTo, $fileFrom, $mode);

		// *** Check upload status
		if (!$upload) {

				$this->logMessage('FTP upload has failed!');
				return false;

			} else {
				$this->logMessage('Uploaded "' . $fileFrom . '" as "' . $fileTo);
				return true;
			}
	}
</pre>
<p>Certainly, you can create or upload any folder name you wish! Add this next snippet of code to your <code>index.php</code> file, and adjust accordingly.</p>
<pre name="code" class="php">
		$fileFrom = 'zoe.jpg';
		$fileTo = $dir . '/' . $fileFrom;

		// *** Upload local file to new directory on server
		$ftpObj -> uploadFile($fileFrom, $fileTo);
</pre>
<p>By now, you should be coming to terms with just how easy this class is to use! We&#8217;re merely making single calls to perform our tasks &#8212; all thanks to object orientated programming! </p>
<hr />
<h2><span>Step 9</span> &#8211; Viewing the Files</h2>
<p>Let&#8217;s now confirm that our file is in the <code>photo</code> folder. We can do so by navigating to the &#8216;<code>photo</code>&#8216; folder on our server, and then display the contents. </p>
<p>The <code>changeDir</code> method uses &#8220;<code>ftp_chdir</code>&#8221; to changes the current directory on the ftp server. Simply pass in the directory to change to. Simple and sweet.</p>
<p>ftp_class.php:</p>
<pre name="code" class="php">
	public function changeDir($directory)
	{
		if (ftp_chdir($this->connectionId, $directory)) {
			$this->logMessage('Current directory is now: ' . ftp_pwd($this->connectionId));
			return true;
		} else {
			$this->logMessage('Couldn\'t change directory');
			return false;
		}
	}
</pre>
<p><code>getDirListing</code> will display the contents of the directory you&#8217;re in by using the function &#8220;<code>ftp_nlist</code>&#8220;. This function returns a list of files in a given directory. The current directory is set by default, so you don&#8217;t need to provide any parameters.</p>
<p>If you wish, you can override this by passing in the <code>$directory</code> path you wish to view the contents of. The <code>$parameters</code> variable defaults to &#8216;<code>-la</code>&#8216;. This is a Linux command to display more information about the directory. Feel free to remove it or pass in an empty string.</p>
<h5>ftp_class.php:</h5>
<pre name="code" class="php">
	public function getDirListing($directory = '.', $parameters = '-la')
	{
		// get contents of the current directory
		$contentsArray = ftp_nlist($this->connectionId, $parameters . '  ' . $directory);

		return $contentsArray;
	}
</pre>
<p>The <code>getDirListing</code> method returns an <code>array</code> which contains our directory listing. </p>
<h5>index.php</h5>
<pre name="code" class="php">
		// *** Change to folder
		$ftpObj->changeDir($dir);

		// *** Get folder contents
		$contentsArray = $ftpObj->getDirListing();

		// *** Output our array of folder contents
		echo '
<pre>';
		print_r($contentsArray);
		echo '</pre>
<p>';
</pre>
<p> Your result should look like so: </p>
<div class="tutorial_image"><img src="http://d2o0t5hpnwv4c1.cloudfront.net/978_ftp/ftp-9.png" border="0" /></div>
<hr />
<h2><span>Step 10</span> &#8211; Downloading a File</h2>
<p>As we push toward the conclusion of this tutorial, we next move on to downloading the file. The method starts with the same code as <code>uploadFile</code>, in that it determines if the file we want to download is <code>ascii</code> or <code>binary</code>.</p>
<p>
For this method, you simply pass in the filename (and possibly the path, depending on if you&#8217;re in the same folder as the file you wish to download) of the file to download, and the name you wish that file to have on your client machine.</p>
<p> In order to download a file, you need to call <code>ftp_get</code>.</p>
<pre name="code" class="php">
ftp_get($this->connectionId, $fileTo, $fileFrom, $mode, 0)
</pre>
<p>This downloads a file from a remote server to our local machine. It accepts the following parameter: our connection id, the path and filename to save as locally (will be overwritten if it<br />
already exists) (<code>$fileTo</code>), the location and name of the file on the remote server (<code>$fileFrom</code>), and the mode (<code>$mode</code>). </p>
<h5>ftp_class.php</h5>
<pre name="code" class="php">
	public function downloadFile ($fileFrom, $fileTo)
	{

		// *** Set the transfer mode
		$asciiArray = array('txt', 'csv');
		$extension = end(explode('.', $fileFrom));
		if (in_array($extension, $asciiArray)) {
			$mode = FTP_ASCII;
		} else {
			$mode = FTP_BINARY;
		}

		// try to download $remote_file and save it to $handle
		if (ftp_get($this->connectionId, $fileTo, $fileFrom, $mode, 0)) {

			return true;
			$this->logMessage(' file "' . $fileTo . '" successfully downloaded');
		} else {

			return false;
			$this->logMessage('There was an error downloading file "' . $fileFrom . '" to "' . $fileTo . '"');
		}

	}
</pre>
<p>We&#8217;re going to download the same file we uploaded by saving it with a different name on our client machine.</p>
<blockquote>
<p><strong>Note:</strong> Again, make sure that your permissions are set correctly!</p>
</blockquote>
<p> Because we should now be inside our <code>photo</code> folder, we don&#8217;t add a path to the <code>$fileFrom</code> variable &#8211; only the file name.</p>
<h5>index.php</h5>
<pre name="code" class="php">
		$fileFrom = 'zoe.jpg';		# The location on the server
		$fileTo = 'zoe-new.jpg';			# Local dir to save to

		// *** Download file
		$ftpObj->downloadFile($fileFrom, $fileTo);
</pre>
<hr />
<h2><span>Step 11</span> &#8211; Finishing Up</h2>
<p>To complete our class, let&#8217;s add the class magic method, <code>__deconstruct</code>. This method closes our connection when the reference to our object no longer exists &#8211; maybe the page was closed. In any event, this code is run and the connection is closed. It&#8217;s always a good practice to include this, though it&#8217;s not entirely necessary.</p>
<pre name="code" class="php">
	public function __deconstruct()
	{
		if ($this->connectionId) {
			ftp_close($this->connectionId);
		}
	}
</pre>
<hr />
<h2>Conclusion</h2>
<p>Well that does it! I hope you now have a better understanding of how to use FTP with PHP. You should now have the necessary skills to further expand this class to support other common tasks, such as renaming or deleting files and folders.</p>
<p>Be sure to let us know if you create any cool PHP FTP clients! </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=WByxTJf6JUc:oRctaQvBjck:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=WByxTJf6JUc:oRctaQvBjck:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=WByxTJf6JUc:oRctaQvBjck:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/WByxTJf6JUc" height="1" width="1"/>]]></description>
			<content:encoded><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=20012&c=984586392' ><img src='http://rss.buysellads.com/img.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=20012&c=984586392' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' >Advertise here</a></p><p>In this tutorial, our goal is to create an FTP class with PHP that is well written, useful, and expandable.</p>
<p><span id="more-20012"></span></p>
<h3> Outlining our Objective </h3>
<p>It&#8217;s always important to first outline exactly what functionality your class should include. In our case:</p>
<ul>
<li>connecting to a server</li>
<li>create a folder on the server</li>
<li>upload a file</li>
<li>change directory</li>
<li>retrieving the directory listing</li>
<li>download a file</li>
</ul>
<h3> When Would I Use an FTP Class? </h3>
<p> There are several instances when one might use this sort of class. A couple of scenarios could be:</p>
<ul>
<li>Automate uploading of images, such as a gallery, to a client&#8217;s website (ideally, in conjunction with my image <a href="http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/">resizing tut</a>)</li>
<li>Perform off-site backups by transferring a database backup file from your server to another. (<em>Note: This isn&#8217;t recommended for sensitive information as FTP is not a very secure protocol.</em>)</li>
</ul>
<blockquote>
<p><strong>Note:</strong> It&#8217;s easy to run into issues with FTP due to different server configurations. This code has been tested on a number of FTP servers successfully.</p>
</blockquote>
<hr />
<h2>What is FTP?</h2>
<blockquote class="pullquote">
<p>
<strong>FTP:</strong> &#8220;A standard network protocol used to copy a file from one host to another.&#8221;
</p>
</blockquote>
<p>FTP, or File Transfer Protocol, is, as defined by Wikipedia: &#8220;A standard network protocol used to copy a file from one host to another over a TCP/IP-based network, such as the Internet.&#8221; </p>
<p>Essentially, it allows you to copy a file(s) from one computer to another.</p>
<hr />
<h2><span>Step 1</span> &#8211; Preparation</h2>
<p>We&#8217;ll start off as easy as possible. In your new project&#8217;s root, create two files: <code>index.php</code> and <code>ftp_class.php</code>.</p>
<p>The <code>index.php</code> file is our main page that creates the object and calls the necessary methods. The <code>ftp_class.php</code> is just that: our ftp class.</p>
<p>In the next step, we&#8217;re going to create the skeleton for our class. Once this is in place, you&#8217;ll be able to follow along and try each step. </p>
<div class="tutorial_image"><img src="http://d2o0t5hpnwv4c1.cloudfront.net/978_ftp/ftp-1.png" border="0" /></div>
<hr />
<h2><span>Step 2</span> &#8211; Setting up the Class</h2>
<p>The strength of Object-Oriented Programming (OOP) is to give complex code an easy to use interface. By creating a class &#8212; think of a class as a pattern &#8212; you can encapsulate the data, which is simply jargon for a term that refers to hiding the data. We can then reuse this class over and over without the need to rewrite any of the code. Instead, you only need to call the appropriate methods (the term &#8220;<code>method</code>&#8221; is the same as <code>function</code>).</p>
<p>Let&#8217;s begin creating our ftp class. Open your <code>ftp_class.php</code> file, and add the following code. This is a basic class skeleton structure, which I&#8217;ve named &#8216;<code>FTPClient</code>&#8216;.</p>
<p>The <code>construct</code> function, known as a constructor, is a special class method that is automatically called by the class when you create a new object, or instance of the class. This is typically a good place to add some initialization; but for today&#8217;s purpose, we don&#8217;t need it. Nonetheless, we&#8217;ll keep it here for future use.</p>
<pre name="code" class="php">
	Class FTPClient
	{
		// *** Class variables

		public function __construct() {	}
	}
</pre>
<p>Please note that we&#8217;re using a  <strong>double</strong> underscore for that <code>construct</code> method.</p>
<hr />
<h2><span>Step 3</span> &#8211; Class Variables</h2>
<p>Next, we&#8217;ll set set some class variables, or properties. </p>
<pre name="code" class="php">
	private $connectionId;
	private $loginOk = false;
	private $messageArray = array();
</pre>
<p>The &#8220;<code>private</code>&#8221; prefix defines the scope of the variable. In this case, it means that the variable can&#8217;t be accessed from anywhere outside of the class.</p>
<p>The <code>$connectionId</code> variable will store our connection stream. The other two store the status and any messages. <code>$loginOk</code> will be useful when determining if we&#8217;re properly connected.</p>
<hr />
<h2><span>Step 4</span> &#8211; Simple Message Logging</h2>
<p> In nearly every method, we&#8217;re going to call a method, named &#8216;<code>logMessage</code>. This is a very basic message handler, that will allow us to capture any messages created by our class so that we can provide the user with feedback. </p>
<blockquote>
<p>Note that we don&#8217;t <code>return</code> the actual messages from within our methods. Instead, we return <code>true</code> or <code>false</code>, based upon whether or not a particular operation was successful. This has its advantages, but also doesn&#8217;t detail to the user what&#8217;s happening.</p>
</blockquote>
<p>Add the following two methods, so we can determine what&#8217;s successful.</p>
<p>This method accepts a variable, <code>$message</code>. The contents of this variable are then saved into our class array, thanks to the line: <code>$this->messageArray[] = $message;</code></p>
<pre name="code" class="php">
	private function logMessage($message)
	{
		$this->messageArray[] = $message;
	}
</pre>
<p>Because <code>$messageArray</code> is a class variable, we can access it, via the <code>$this-></code> notation. </p>
<blockquote>
<p>Within a class, <code>$this</code> refers to the object itself.</p>
</blockquote>
<p>To retrieve the message, we call <code>getMessages</code>.</p>
<pre name="code" class="php">
	public function getMessages()
	{
		return $this->messageArray;
	}
</pre>
<p>This method is a public method. As mention previously, this private/public business simply refers to the scope of the variable, or in this case, the method. A private method (or variable) cannot be accessed outside of the class, while a public method (or variable) can.  </p>
<p>Because our variable is private, we need a way to access it. We do this by giving our class a <code>public</code> method, which we can then access outside of the class. You might wonder why we can&#8217;t simply make the <code>messageArray</code> variable public. We can; that said, it&#8217;s just not a good practice.</p>
<p><strong>Note:</strong> There are plenty examples around the web of full blown message handlers, or classes dedicated to them. We&#8217;re working on a simple implementation for the purpose of this tutorial.</p>
<hr />
<h2><span>Step 5</span> &#8211; Connecting</h2>
<p>In this step, we&#8217;ll add the <code>connect</code> method. This will allow us to connect to an FTP server.</p>
<pre name="code" class="php">
	public function connect ($server, $ftpUser, $ftpPassword, $isPassive = false)
	{

		// *** Set up basic connection
		$this->connectionId = ftp_connect($server);

		// *** Login with username and password
		$loginResult = ftp_login($this->connectionId, $ftpUser, $ftpPassword);

		// *** Sets passive mode on/off (default off)
		ftp_pasv($this->connectionId, $isPassive);

		// *** Check connection
		if ((!$this->connectionId) || (!$loginResult)) {
			$this->logMessage('FTP connection has failed!');
			$this->logMessage('Attempted to connect to ' . $server . ' for user ' . $ftpUser, true);
			return false;
		} else {
			$this->logMessage('Connected to ' . $server . ', for user ' . $ftpUser);
			$this->loginOk = true;
			return true;
		}
	}
</pre>
<p>We pass in our connection information: the server (<code>$server</code>), username (<code>$ftpUser</code>), and password (<code>$ftpPassword</code>) to allow us to establish a connection. </p>
<p>
The first line of code opens an FTP connection, with <code>ftp_connect</code>, to the specified server. We save our connection to the class variable, <code>$connectionId</code> described above.</p>
<p>The code, <code>ftp_login</code> logs us in to the specified connection, passing in our <code>connection id</code>, our username, and password.</p>
<p>You might have noticed the <code>ftp_pasv</code> line of code. This, as the comment implies, turns on/off passive mode. I&#8217;d suggest you leave it off, however, if you have any issues connecting, try turning it on. Passive mode can cause a bit of a mare when connecting via FTP.</p>
<p>We determine if the connection was successful. We then log the results by calling our simple message handler method, <code>logMessage()</code>, and pass the string to log. Remember: we use <code>$this-></code> to access <code>logMessage()</code>, as it is a class variable. </p>
<hr />
<h2><span>Step 6</span> &#8211; Calling the Object</h2>
<p>Now that our class is working, we can test it out! Open your <code>index.php</code> file, and add the following code. </p>
<blockquote>
<p>You&#8217;ll need access to an FTP server to play along. If you wish to set your own server up, try <a href="http://filezilla-project.org/download.php?type=server">Filezilla</a> &#8211; it&#8217;s free, too.</p>
</blockquote>
<p>You&#8217;ll notice I&#8217;ve added the FTP server details here. Ideally these would be stored within your <code>config</code> file. Change these to match the settings of your FTP server.</p>
<p>After defining our FTP server details, we include the class with <code>include('ftp_class.php');</code>. This means: make the class available from within this page. The next line creates an object of our FTP class, and stores it in the variable, <code>$ftpObj</code>. <code>$ftpObj</code> will now be used to access any public methods within our class. This is done by using the <code>-></code> notation, just like the following line does by calling the <code>$ftpObj -> connect</code> method and passing it our server details.</p>
<pre name="code" class="php">
		// *** Define your host, username, and password
		define('FTP_HOST', '192.168.1.88');
		define('FTP_USER', 'Blimpf');
		define('FTP_PASS', 'catfish');

		// *** Include the class
		include('ftp_class.php');

		// *** Create the FTP object
		$ftpObj = new FTPClient();

		// *** Connect
		$ftpObj -> connect(FTP_HOST, FTP_USER, FTP_PASS);
</pre>
<p>As you can see, once our class is in place, connecting to our FTP server is really quite easy!</p>
<hr />
<h2><span>Step 6b</span> &#8211; Viewing the Output</h2>
<p>In the last step we could wrap the connect call in an <code>if</code> statement, as demonstrated below. Then, if we fail to connect, the dependent code won&#8217;t be executed. We can then output any messages to the user,  such as &#8220;connected&#8221; or &#8220;failed&#8221;.</p>
<pre name="code" class="php">
		// *** Connect
		if ($ftpObj -> connect(FTP_HOST, FTP_USER, FTP_PASS)) {

			// *** Then add FTP code here

			echo 'connected';

		} else {
			echo 'Failed to connect';
		}
</pre>
<p>This is okay, though our code will quickly become rather bloated with IF/ELSE statements, if we add this to all our calls. Instead, I&#8217;d like to offer an alternative that will make things a bit cleaner and easier to follow. </p>
<p>Remember the message handler methods we added? If you wish to see the messages produced by the class &#8211; helpful for debugging/feedback &#8211; you can add the following code after any method that you call.</p>
<pre name="code" class="php">
		print_r($ftpObj -> getMessages());
</pre>
<p>This will display the class message.</p>
<hr />
<h2><span>Step 7</span> &#8211; Making our First Directory</h2>
<p>Excellent, now it&#8217;s time to do something useful. The first method we&#8217;re going to create is the <code>makeDir</code> method. As expected, this method will create directories for us on the server. The only parameter we will pass is the directory path and folder name; we&#8217;ll call it <code>$directory</code>. The magical line here is the <code>ftp_mkdir</code> built-in function. It uses our saved &#8220;<code>connectionId</code>&#8221; and the passed in <code>$directory</code> variable to create the folder. </p>
<p>Add the following code to your <code>ftp_class.php</code> file:</p>
<pre name="code" class="php">
		public function makeDir($directory)
		{
			// *** If creating a directory is successful...
			if (ftp_mkdir($this->connectionId, $directory)) {

				$this->logMessage('Directory "' . $directory . '" created successfully');
				return true;

			} else {

				// *** ...Else, FAIL.
				$this->logMessage('Failed creating directory "' . $directory . '"');
				return false;
			}
		}
</pre>
<p>And, to call it from your <code>index.php</code> file, add:</p>
<pre name="code" class="php">
		$dir = 'photos';	

		// *** Make directory
		$ftpObj->makeDir($dir);
</pre>
<p>The variable, <code>$dir</code> is set to the name of the folder we want to create on the server. In this case: &#8220;photos&#8221;.</p>
<p>The next line calls the method that will create the folder.</p>
<blockquote>
<p>If you receive a &#8220;Permission denied&#8221; error, make sure that you can write in the folder specified. You might need to create the folder within a directory, such as <code>/httpdocs</code>. </p>
</blockquote>
<hr />
<h2><span>Step 8</span> &#8211; Uploading a File</h2>
<p>Continuing on, let&#8217;s upload a photo, called <code>zoe.jpg</code>. When uploading a file, we need to specify what type of file we&#8217;re uploading &#8211; <code>binary</code> or <code>ascii</code>? Basically, if you&#8217;re uploading a text file, we should use <code>ascii</code>; otherwise, it should be set to binary.</p>
<p> We begin by setting up an <code>array</code> with all the extensions that we should use for an <code>ascii</code> type upload.</p>
<pre name="code" class="php">
$asciiArray = array('txt', 'csv');
</pre>
</p>
<p> Then, we retrieve the extension of our file, so we can test if it is one of the <code>ascii</code> types. We determine this by getting the extension of the file we&#8217;re uploading. The quick and dirty method I have used here is<br />
by &#8220;<a href="http://php.net/manual/en/function.explode.php">exploding</a>&#8221; the file using the &#8216;<code>.</code>&#8216; as the delimiter. This will split the file into pieces, and store them as an <code>array</code>. Using another built-in PHP function, &#8220;<a href="http://php.net/manual/en/function.end.php">end</a>&#8220;, we select the last <code>array</code> element that contains our extension. It&#8217;s a tidy little bit of code.
</p>
<pre name="code" class="php">
$extension = end(explode('.', $fileFrom));
</pre>
<p>Next, we test if our extension appears in the list (with <a href="http://nz.php.net/manual/en/function.in-array.php">in_array</a>) of file extensions that should be uploaded as type <code>ascii</code>. If it appears in the list, we set the variable <code>$mode</code> to <code>FTP_ASCII</code>; otherwise, we assume it&#8217;s of binary type, and assign <code>$mode</code> the value <code>FTP_BINARY</code>.</p>
<pre name="code" class="php">
in_array($extension, $asciiArray)
</pre>
<p><code>ftp_put</code> uploads a file from your local location to a remote file on the ftp server. We pass it our &#8220;<code>connectionId</code>&#8220;, the path to the file we want to upload to (<code>$fileTo</code>), the path<br />
of the file we want to upload (<code>$fileFrom</code>), and the mode (<code>$mode</code>) which we&#8217;ve just determined.</p>
<div class="tutorial_image"><img src="http://d2o0t5hpnwv4c1.cloudfront.net/978_ftp/zoe.jpg" border="0" /></div>
<p>Next, add the following method to your <code>ftp_class.php</code> file:</p>
<pre name="code" class="php">
	public function uploadFile ($fileFrom, $fileTo)
	{
		// *** Set the transfer mode
		$asciiArray = array('txt', 'csv');
		$extension = end(explode('.', $fileFrom));
		if (in_array($extension, $asciiArray)) {
			$mode = FTP_ASCII;
		} else {
			$mode = FTP_BINARY;
		}

		// *** Upload the file
		$upload = ftp_put($this->connectionId, $fileTo, $fileFrom, $mode);

		// *** Check upload status
		if (!$upload) {

				$this->logMessage('FTP upload has failed!');
				return false;

			} else {
				$this->logMessage('Uploaded "' . $fileFrom . '" as "' . $fileTo);
				return true;
			}
	}
</pre>
<p>Certainly, you can create or upload any folder name you wish! Add this next snippet of code to your <code>index.php</code> file, and adjust accordingly.</p>
<pre name="code" class="php">
		$fileFrom = 'zoe.jpg';
		$fileTo = $dir . '/' . $fileFrom;

		// *** Upload local file to new directory on server
		$ftpObj -> uploadFile($fileFrom, $fileTo);
</pre>
<p>By now, you should be coming to terms with just how easy this class is to use! We&#8217;re merely making single calls to perform our tasks &#8212; all thanks to object orientated programming! </p>
<hr />
<h2><span>Step 9</span> &#8211; Viewing the Files</h2>
<p>Let&#8217;s now confirm that our file is in the <code>photo</code> folder. We can do so by navigating to the &#8216;<code>photo</code>&#8216; folder on our server, and then display the contents. </p>
<p>The <code>changeDir</code> method uses &#8220;<code>ftp_chdir</code>&#8221; to changes the current directory on the ftp server. Simply pass in the directory to change to. Simple and sweet.</p>
<p>ftp_class.php:</p>
<pre name="code" class="php">
	public function changeDir($directory)
	{
		if (ftp_chdir($this->connectionId, $directory)) {
			$this->logMessage('Current directory is now: ' . ftp_pwd($this->connectionId));
			return true;
		} else {
			$this->logMessage('Couldn\'t change directory');
			return false;
		}
	}
</pre>
<p><code>getDirListing</code> will display the contents of the directory you&#8217;re in by using the function &#8220;<code>ftp_nlist</code>&#8220;. This function returns a list of files in a given directory. The current directory is set by default, so you don&#8217;t need to provide any parameters.</p>
<p>If you wish, you can override this by passing in the <code>$directory</code> path you wish to view the contents of. The <code>$parameters</code> variable defaults to &#8216;<code>-la</code>&#8216;. This is a Linux command to display more information about the directory. Feel free to remove it or pass in an empty string.</p>
<h5>ftp_class.php:</h5>
<pre name="code" class="php">
	public function getDirListing($directory = '.', $parameters = '-la')
	{
		// get contents of the current directory
		$contentsArray = ftp_nlist($this->connectionId, $parameters . '  ' . $directory);

		return $contentsArray;
	}
</pre>
<p>The <code>getDirListing</code> method returns an <code>array</code> which contains our directory listing. </p>
<h5>index.php</h5>
<pre name="code" class="php">
		// *** Change to folder
		$ftpObj->changeDir($dir);

		// *** Get folder contents
		$contentsArray = $ftpObj->getDirListing();

		// *** Output our array of folder contents
		echo '
<pre>';
		print_r($contentsArray);
		echo '</pre>
<p>';
</pre>
<p> Your result should look like so: </p>
<div class="tutorial_image"><img src="http://d2o0t5hpnwv4c1.cloudfront.net/978_ftp/ftp-9.png" border="0" /></div>
<hr />
<h2><span>Step 10</span> &#8211; Downloading a File</h2>
<p>As we push toward the conclusion of this tutorial, we next move on to downloading the file. The method starts with the same code as <code>uploadFile</code>, in that it determines if the file we want to download is <code>ascii</code> or <code>binary</code>.</p>
<p>
For this method, you simply pass in the filename (and possibly the path, depending on if you&#8217;re in the same folder as the file you wish to download) of the file to download, and the name you wish that file to have on your client machine.</p>
<p> In order to download a file, you need to call <code>ftp_get</code>.</p>
<pre name="code" class="php">
ftp_get($this->connectionId, $fileTo, $fileFrom, $mode, 0)
</pre>
<p>This downloads a file from a remote server to our local machine. It accepts the following parameter: our connection id, the path and filename to save as locally (will be overwritten if it<br />
already exists) (<code>$fileTo</code>), the location and name of the file on the remote server (<code>$fileFrom</code>), and the mode (<code>$mode</code>). </p>
<h5>ftp_class.php</h5>
<pre name="code" class="php">
	public function downloadFile ($fileFrom, $fileTo)
	{

		// *** Set the transfer mode
		$asciiArray = array('txt', 'csv');
		$extension = end(explode('.', $fileFrom));
		if (in_array($extension, $asciiArray)) {
			$mode = FTP_ASCII;
		} else {
			$mode = FTP_BINARY;
		}

		// try to download $remote_file and save it to $handle
		if (ftp_get($this->connectionId, $fileTo, $fileFrom, $mode, 0)) {

			return true;
			$this->logMessage(' file "' . $fileTo . '" successfully downloaded');
		} else {

			return false;
			$this->logMessage('There was an error downloading file "' . $fileFrom . '" to "' . $fileTo . '"');
		}

	}
</pre>
<p>We&#8217;re going to download the same file we uploaded by saving it with a different name on our client machine.</p>
<blockquote>
<p><strong>Note:</strong> Again, make sure that your permissions are set correctly!</p>
</blockquote>
<p> Because we should now be inside our <code>photo</code> folder, we don&#8217;t add a path to the <code>$fileFrom</code> variable &#8211; only the file name.</p>
<h5>index.php</h5>
<pre name="code" class="php">
		$fileFrom = 'zoe.jpg';		# The location on the server
		$fileTo = 'zoe-new.jpg';			# Local dir to save to

		// *** Download file
		$ftpObj->downloadFile($fileFrom, $fileTo);
</pre>
<hr />
<h2><span>Step 11</span> &#8211; Finishing Up</h2>
<p>To complete our class, let&#8217;s add the class magic method, <code>__deconstruct</code>. This method closes our connection when the reference to our object no longer exists &#8211; maybe the page was closed. In any event, this code is run and the connection is closed. It&#8217;s always a good practice to include this, though it&#8217;s not entirely necessary.</p>
<pre name="code" class="php">
	public function __deconstruct()
	{
		if ($this->connectionId) {
			ftp_close($this->connectionId);
		}
	}
</pre>
<hr />
<h2>Conclusion</h2>
<p>Well that does it! I hope you now have a better understanding of how to use FTP with PHP. You should now have the necessary skills to further expand this class to support other common tasks, such as renaming or deleting files and folders.</p>
<p>Be sure to let us know if you create any cool PHP FTP clients! </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=WByxTJf6JUc:oRctaQvBjck:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=WByxTJf6JUc:oRctaQvBjck:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=WByxTJf6JUc:oRctaQvBjck:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=WByxTJf6JUc:oRctaQvBjck:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/WByxTJf6JUc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/nettuts/~3/WByxTJf6JUc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big vs. small: Challenges in responsive web design</title>
		<link>http://www.webdesignerdepot.com/2011/05/big-vs-small-challenges-in-responsive-web-design/</link>
		<comments>http://www.webdesignerdepot.com/2011/05/big-vs-small-challenges-in-responsive-web-design/#comments</comments>
		<pubDate>Wed, 11 May 2011 11:51:40 +0000</pubDate>
		<dc:creator>Walter</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.webdesignerdepot.com/?p=22553</guid>
		<description><![CDATA[<a
href='http://rss.buysellads.com/click.php?z=1259940&#038;k=75e07a75487088b1694a6868e9c95d21&#038;a=22553&#038;c=1337452910' target='_blank'><img
src='http://rss.buysellads.com/img.php?z=1259940&#038;k=75e07a75487088b1694a6868e9c95d21&#038;a=22553&#038;c=1337452910' border='0' alt='' /></a><p><a
href='http://buysellads.com/buy/sitedetails/pubkey/75e07a75487088b1694a6868e9c95d21/zone/1259940' target='_blank'>Advertise here with BSA</a></p><br
/>As the number and variety of devices from which we access the internet increases, new web design challenges present themselves. It&#8217;s no longer simply enough to have a mobile version and a browser version. Now, we have to consider whether the person visiting our site is visiting from a tablet, a smartphone (and whether that [...]]]></description>
			<content:encoded><![CDATA[<a
href='http://rss.buysellads.com/click.php?z=1259940&k=75e07a75487088b1694a6868e9c95d21&a=22553&c=796981869' ><img
src='http://rss.buysellads.com/img.php?z=1259940&k=75e07a75487088b1694a6868e9c95d21&a=22553&c=796981869' border='0' alt='' /></a><p><a
href='http://buysellads.com/buy/sitedetails/pubkey/75e07a75487088b1694a6868e9c95d21/zone/1259940' >Advertise here with BSA</a></p><br
/><p><a
href="http://commons.wikimedia.org/wiki/File:IPad-02.jpg"><img
class="alignleft" src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/thumbnail.jpg" alt="" width="200" height="160" /></a>As the number and variety of devices from which we access the  internet increases, new web design challenges present themselves.</p><p>It&#8217;s  no longer simply enough to have a mobile version and a browser version.  Now, we have to consider whether the person visiting our site is  visiting from a tablet, a smartphone (and whether that smartphone has a  high-res screen or not), a netbook, a desktop computer or full-size  laptop (and whether it&#8217;s one with a high-res or low-res screen), or some  other device entirely.</p><p>And optimizing the experience for all of those  different possibilities is becoming more expected among savvy internet  users.</p><p>A few years ago, a designer would have looked at the list of devices  they had to design for and then set about creating individual website  designs for each device. But as the number and variety of devices  increases, that becomes an impractical, time-consuming proposition.</p><p>Instead, designers should create designs that adapt to the needs of each browser, regardless of the device.<span
id="more-22553"></span></p><h1>A lot of screens keep getting bigger</h1><p>The screen resolutions of desktop and laptop computers keeps getting  bigger. Only a couple of years ago, a 1280 x 800 pixel resolution seemed  large. Now, that&#8217;s pretty much the bottom-end of common screen  resolutions on laptops, and it&#8217;s not uncommon for new monitors to have  full HD screen resolutions (1920 x 1080 pixels).</p><p>We&#8217;re reaching the  upper limits of what&#8217;s practical for a monitor (with current interface  technologies, though future developments may change that), but even  designing for 1920 pixel widths is a lot different than designing for a  screen that&#8217;s only 1024 pixels wide. Or at least it should be.</p><p><a
href="http://commons.wikimedia.org/wiki/File:Sony_Internet_TV_BestBuy_jeh.jpg"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/internettv.jpg" alt="" /></a></p><p>Adding to potential large-screen issues is that a lot of game systems  and new TVs now come internet-ready. Some of these actually have very  good built-in browsers, so it&#8217;s entirely possible that some of your  website&#8217;s visitors will be viewing your site on their 55&#8243; HD TV.</p><p><br
class="spacer_" /></p><h1>But then there are mobile devices</h1><p>On the opposite end of the spectrum is the huge number of internet  users who are now accessing the web primarily from their smartphone,  tablet, or netbook. Screens on these devices can range from about 240 x  320 pixels (on some lower-end and older smartphones) to 1024 x 600 or  768 (on some netbooks and tablets).</p><p><a
href="http://commons.wikimedia.org/wiki/File:IPad-02.jpg"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/ipad.jpg" alt="" /></a></p><p>Obviously, a site designed for a monitor that&#8217;s 1280+ pixels wide  isn&#8217;t going to look right on a screen that&#8217;s only 320 pixels wide. Or  even one that&#8217;s 600 or 800 pixels wide. Horizontal scroll, especially on  touchscreen devices, is annoying at best.</p><p>Designing a mobile site used to be the favored solution to differing  screen resolutions. But since now there&#8217;s a huge range of sizes, rather  than just &#8220;normal&#8221; and &#8220;tiny&#8221;, that&#8217;s not the best idea anymore. Mobile  sites designed for a 240 x 320 pixel screen aren&#8217;t going to look good on  an iPad (or even a new iPhone with the Retina Display). And if you  design for the Retina Display or similar higher-res device screens,  you&#8217;re going to alienate a lot of visitors using other smartphones that  don&#8217;t have such high resolution screens.</p><p><br
class="spacer_" /></p><h1>A flexible foundation</h1><p>Starting with a flexible foundation is important. A fluid grid alone  isn&#8217;t enough. You also need a grid or layout that can change based on  screen resolutions and device types. For simple layouts, that&#8217;s not such  a tall order. But if you&#8217;d like something that&#8217;s a bit more complex,  with varying numbers of columns depending on the screen width, there are  a few things you have to take into consideration.</p><h2>Flexible layouts</h2><p>Creating a fluid grid is a  fantastic way to create a more <a
rel="nofollow" href="http://www.alistapart.com/articles/responsive-web-design/" >responsive design</a>. The best fluid grids  will combine resizing and repositioning content as necessary, as the  screen width changes. (Another great tool for creating fluid grids is  the <a
href="http://www.tinyfluidgrid.com/">Tiny Fluid Grid</a>, which lets you make grids with up to 1200px maximum widths, and is based on the 1kb Grid.)</p><p>For example, as long as your screen resolution stays above 800px  wide, a 3-column layout would stay 3 columns, simple adjusting the width  of each column to best serve the content. But when the screen width  drops below 800px, your third column might drop under your second  column, so that each column can stay an easily-readable width.</p><p>If the screen gets even narrower, let&#8217;s say 480px (typical on a lot  of smartphones), the whole design drops to a single column, with the  second and third columns appearing below the main content. If the  navigation was contained within one of those columns, it might migrate  to the top of the page, so that it&#8217;s still easily accessible.</p><p>Using CSS3 media queries lets us target not only a specific class of  devices (such as mobile devices), but also particular specifications  within those devices. So we could have separate stylesheets for a number  of different sizes of devices.</p><p>The beauty of media queries in CSS3, though, is that they can also be  used right within the CSS. So if all we need to change is the number of  columns, or something similar, we can just define a <code>@media</code> rule within the stylesheet. <a
href="http://www.webdesignerwall.com/tutorials/css3-media-queries/">WebDesignerWall</a> has a great overview of how to use CSS3 Media Queries.</p><p><br
class="spacer_" /></p><h2>Fluid images</h2><p>Creating images that adjust to the size of the column or div that  they&#8217;re in is another important aspect of creating a more responsive  design within a fluid layout. As columns resize, the images they contain  can resize so that they still fit within the constraints of the column.</p><p>There are a couple of ways to go about this: you can have your image  resize completely on the fly, or you can dynamically crop the image to  only show the most important parts. In some cases, using a combination  of these two techniques (so that above a certain size, the image just  shrinks, but when it gets below that size it starts to crop) can provide  the most desirable results.</p><p><a
href="http://unstoppablerobotninja.com/entry/fluid-images/">Unstoppable Robot Ninja</a> has a simple script that automatically resizes your images. If you want  to selectively hide parts of your image dynamically (effectively  cropping them), <a
href="http://zomigi.com/blog/hiding-and-revealing-portions-of-images/">Zomigi.com</a> has a great method for doing that. They also have a method for creating <a
href="http://zomigi.com/blog/creating-sliding-composite-images/">sliding composite images</a> that can be useful for fluid designs.</p><p><br
class="spacer_" /></p><h1>Wider screen considerations</h1><p>According to <a
href="http://www.statowl.com/screen_resolution.php?1=1&#038;timeframe=last_6&#038;interval=month&#038;chart_id=2&#038;fltr_br=&#038;fltr_os=&#038;fltr_se=&#038;fltr_cn=&#038;timeframe=last_3">StatOwl</a>,  over 73% of non-mobile internet users during the past three months were  using computers with a resolution higher than 1024 x 768. And if you  look at the stats for 1024 x 768 specifically, you&#8217;ll see that it&#8217;s  losing market share. It&#8217;s clear that there&#8217;s already a huge shift to  higher screen resolutions—one that designers would be ill-advised to  ignore.</p><p>Of course, just because there are some users out there who have moved  on to wider screen resolutions doesn&#8217;t mean that every designer out  there should jump on the wide-width bandwagon and start pushing  redesigns to their clients. Mobile adoption is more important at the  moment than wider widths. But since we&#8217;ve hopefully convinced you by now  that responsive design is the way to approach new website designs and  redesigns, it&#8217;s important to consider how to make websites work at wider  widths.</p><p><br
class="spacer_" /></p><h2>Who&#8217;s using wider resolution screens?</h2><p>Anyone working in design or creative fields likely has a screen  resolution of at least 1280 pixels wide (if not much wider). This  includes web and graphic designer, filmmakers, photographers, and  others. Tech-savvy users are also more likely to be using  higher-resolution screens, since they&#8217;re more likely to upgrade their  computer equipment regularly.</p><p>Wealthy consumers are another group likely to be using higher  resolution monitors. Like with tech-savvy users, this is due to the fact  that people with more disposable income are more likely to buy newer  computers on a regular basis. Of course, this effect is multiplied with  consumers who are both wealthy and tech-savvy.</p><p><a
href="http://www.flickr.com/photos/stefanoost/2326454573/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/macbook.jpg" alt="" /></a></p><p>Mac fans would be another group more likely to be using a higher  screen resolution, due to the fact that newer MacBooks, iMacs, and other  Apple computers all have screen resolutions of at least 1280 x 800. Of  course, this excludes the products they have running on iOS (the iPhone,  iPod Touch, and iPad).</p><p><br
class="spacer_" /></p><h2>Who isn&#8217;t using wider res screens?</h2><p>While there are plenty of users out there using higher resolution  screens, there are still a lot of internet users who aren&#8217;t. These fall  into a few different groups.</p><p>Students are probably one of the largest groups of lower-res users.  Schools often have to make do with computers for five or ten years, and  in many cases, the computers they have aren&#8217;t even state-of-the-art when  they purchase them. If your website is aimed at educational users  (including school faculty and administrators, in addition to students),  you&#8217;re probably looking at a lot of users whose screens are only 1024  pixels wide, and maybe even some who still have monitors set to 800  pixels wide.</p><p><a
href="http://www.flickr.com/photos/magicfab/3950993190/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/netbook.jpg" alt="" /></a></p><p>Netbook users are another big group that generally has lower-res  screens. Most netbooks, especially the lower-end ones, have screen  resolutions of 1024 by 600 or 728 pixels or so. The same is true of the  iPad (1024&#215;768) and many other tablets on the market, some of which have  even lower screen resolutions.</p><p>People in less developed countries are likely using older or  lower-end computers. If you&#8217;re targeting users who aren&#8217;t in North  America or Western Europe, or in areas where internet cafes are commonly  used for internet access (as is the case in many developing nations),  then you&#8217;re likely looking at a majority of users viewing your site at  1024 by 768 or similar screen resolutions.</p><p>Business users often have lower screen resolutions, too. Many  non-tech businesses will hang on to computer equipment until it&#8217;s  absolutely obsolete before upgrading. And it makes sense, especially  considering the cost of upgrading dozens or hundreds of computers at  once. If you&#8217;re targeting business users, you may want to stick with a  design based on the 1024 width.</p><p>The last group that is likely to have lower-resolution screens are  people who don&#8217;t value technology. While these people used to not bother  with computers at all, many are now seeing the value in having a PC at  home. But they&#8217;re also unlikely to go out and spend more than a few  hundred dollars on a PC, or they might get a used computer from a family  member or the classified ads. If your website is focused on non-tech  consumers, especially those in rural areas, you&#8217;ll want to carefully  consider what the likely screen resolutions are, and design accordingly.</p><p><br
class="spacer_" /></p><h2>Track your visitors</h2><p>Everything mentioned above brings us to one of the most important  steps to take if you&#8217;re considering designing for a wider screen  resolution: track the visitors who come to your site and look at what  screen resolution they&#8217;re using. Any good analytics program will give  you this information, and it&#8217;s incredibly valuable in making decisions  like this.</p><p>If you find that the vast majority of your users are coming from  computers with higher screen resolutions, then you can probably design  your site for those users without seeing too much impact. But if you  find that a large number of your visitors are still using screen  resolutions of 1024 or narrower, then you may want to reconsider.</p><p><br
class="spacer_" /></p><h2>Wider widths are important for innovation</h2><p>I&#8217;m sure there are a lot of designers out there who don&#8217;t really see  the point in wider widths. They&#8217;re happy designing at 960 pixels.  They&#8217;ve got systems in place for designing at those widths. They have  pre-made CSS files all set for 960 pixels. Why would they want to go  wider? Especially when a big chunk of internet users are still working  with screens that 1024 pixels wide.</p><p>The simple answer is that as long as we keep designing for 1024,  there&#8217;s no incentive for most consumers to upgrade. And that means  there&#8217;s little incentive for manufacturers to create products with  higher resolutions.</p><p>For example, if 1280 was the standard, and if the majority of  websites out there were 1140 pixels wide or wider, it&#8217;s likely the iPad  would have been developed with a resolution of at least 1280. But  because 1024 is the standard, the iPad doesn&#8217;t need to be higher res  than that. The same principle applies to netbooks. Since the web is  designed around screen widths of 1024 pixels, devices intended primarily  for web use don&#8217;t need to be higher res than that.</p><p>By pushing website designs to wider widths, we&#8217;re encouraging  upgrades and innovation. Plus, those extra 180 pixels (the difference  between 960 and 1140) can open up new possibilities in the world of user  interface design and user experience. Just like the 160 pixels gained  when we switched from 800 to 960 made more things possible.</p><p><br
class="spacer_" /></p><h2>The downsides to wide widths</h2><p>While there are definite advantages to creating wider designs, there  are also definite downsides to the practice. Some of these are easily  overcome, but it&#8217;s important to be aware of what they are if you expect  to prevent them.</p><p><strong>Wide line lengths decrease readability</strong></p><p>It&#8217;s tempting when creating a wider design to take advantage of all  that extra screen real estate to make your main content area wider. This  isn&#8217;t always a good idea, though. Longer line lengths are harder to  read, as the eye has to travel further at the end of a line to get to  the beginning of the next line, which means the reader can more easily  get lost and end up on the wrong line. This is exacerbated by smaller  type sizes. It&#8217;s important to strike a happy medium between line length,  font size, and line height.</p><p>There are a couple of <a
href="http://desktoppub.about.com/cs/finetypography/ht/line_length.htm">different methods</a> for calculating the proper line length. The first one is the  alphabet-and-a-half rule, which results in a line length of 39  characters (26 letters in the alphabet x 1.5). Adapt your font size so  that roughly 39 characters fit on your chosen line length (or vice  versa).</p><p>The second method of calculating optimal line length is to apply the  &#8220;points times two&#8221; rule. This is a holdover from the world of print, but  can be adapted to the web easily enough. With this rule, you take the  point size of your font, multiply it by two, and then make your lines  that length in <em>picas</em> (which, in print, are 12 points). So, to  calculate your line lengths in pixels, you&#8217;d take your font size and  multiply it by 24 (a 12-point font would have a line length of 288  pixels).</p><p>It can be helpful to calculate your line lengths with both of these  methods, and then compare. Make your final line lengths somewhere  between the two.</p><p><br
class="spacer_" /></p><p><strong>Information overload</strong></p><p>Wider content areas can easily contribute to making your pages look  cluttered and like there&#8217;s too much going on. It also makes it easier to  add extra columns, widgets, or other content that might not really add  any value to the page. It&#8217;s important to keep principles of good content  design in mind when creating your site. Ample white space is also  helpful in making sure your site doesn&#8217;t look cluttered.</p><p>Wider widths give you more options when it comes to design, but it  also multiplies the chances that you&#8217;ll make poor design decisions. Go  too minimalist and it can look boring and empty. Too much going on and  it just looks busy and cluttered.</p><p>Pay attention to scale, white space,  proportion, and hierarchy in your designs to ensure an excellent final  product. And be careful that your wider designs don&#8217;t end up being &#8220;too  much&#8221; in general.</p><p><br
class="spacer_" /></p><h1>So why isn&#8217;t everyone doing responsive design?</h1><p>While responsive design does address a lot of the core issues  presented by the wide variety of devices being used to access the  internet, it can also create some new problems.</p><p>Take mobile devices, for  instance. If a person is accessing a movie theater website on their  smartphone, it&#8217;s likely their primary concern is show times, directions  to the theater, or maybe the phone number to the theater. They want  immediate access to that kind of information. Loading up the entire  website, that also includes things like movie reviews and other  information, only to hide a good chunk of it from that mobile user is a  waste of resources.</p><p>So it&#8217;s important to look at responsive design on a case-by-case  basis, to figure out if it&#8217;s the best solution for a particular website.  In many cases, it is, but there are still some instances where a more  traditional mobile site might be preferable.</p><p>As designers, though, it&#8217;s important to understand responsive design,  and to be able to know when it is the appropriate solution for your  projects. Since much of responsive design is built upon creating  well-formed, flexible websites, it can serve as a sort of best-practices  guide for designers as we move forward with web design and web  standards.</p><p><br
class="spacer_" /></p><h1>More resources for creating responsive designs</h1><ul><li><a
href="http://comato.se/flurid/">Flurid</a>: Flurid is a fluid  grid design that will adapt across a variety of window widths. While not  particularly responsive on its own (other than adjusting column  widths), it can serve as the backbone for creating a responsive site.</li><li><a
href="http://www.alistapart.com/articles/fluidgrids/">Fluid Grids</a>: This article from A List Apart discusses the advantages and particulars of working with fluid grids.</li><li><a
href="http://fluid.newgoldleaf.com/">Fluid Grid System</a>: Another fluid grid framework.</li><li><a
href="http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries">Hardboiled CSS3 Media Queries</a>: Another great guide to Media Queries.</li></ul><p><br
class="spacer_" /></p><h1>Examples of responsive website designs</h1><p>Not all of the designs below adapt right down to mobile sizes, but  some do, and they all can give you ideas of how you might adapt your  website designs to be more responsive across devices.</p><p><strong><a
href="http://www.creativedepart.com/">CreativeDepart</a></strong></p><p><a
href="http://www.creativedepart.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/creativedepartsmall.jpg" alt="" /></a></p><p><a
href="http://www.creativedepart.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/creativedepartwide.jpg" alt="" /></a></p><p>The columns here will stack based on screen width, but are always at least 4-across.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://teruhiroyanagihara.jp/">Teruhiro Yanagihara</a></strong></p><p><a
href="http://teruhiroyanagihara.jp/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/teruhiroyanagihara.jpg" alt="" /></a></p><p>This grid rearranges itself and resizes the columns dynamically to best fit your browser window.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://thisalso.com/">This Also</a></strong></p><p><a
href="http://thisalso.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/thisalso.jpg" alt="" /></a></p><p>This Also rearranges the images to best fill your browser window.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://css-tricks.com/">CSS-Tricks</a></strong></p><p><a
href="http://css-tricks.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/csstrickswide.jpg" alt="" /></a></p><p><a
href="http://css-tricks.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/csstrickssmall.jpg" alt="" /></a></p><p>CSS-Tricks adapts to wider screen resolutions, while moving the sidebar under the main content for narrower screens.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://abduzeedo.com/">Abduzeedo</a></strong></p><p><a
href="http://abduzeedo.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/abduzeedo.jpg" alt="" /></a></p><p>The Abduzeedo shifts the content around on the homepage based on your browser width.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://psd.tutsplus.com/">Psdtuts+</a></strong></p><p><a
href="http://psd.tutsplus.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/psdtutswide.jpg" alt="" /></a></p><p><a
href="http://psd.tutsplus.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/psdtutssmall.jpg" alt="" /></a></p><p>The Psdtuts+ website (along with all the other Tuts+ sites) resizes  and restacks their sidebars based on the width of your browser window.  They also change the width of the main content column to accommodate  different sizes.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://colly.com/">Simon Collison</a></strong></p><p><a
href="http://colly.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/collyfour.jpg" alt="" /></a></p><p><a
href="http://colly.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/collytwo.jpg" alt="" /></a></p><p><a
href="http://colly.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/collyone.jpg" alt="" /></a></p><p>The grid here shifts from four columns to two to one based on the screen width.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://hardboiledwebdesign.com/samples/">Hardboiled Web Design</a></strong></p><p><a
href="http://hardboiledwebdesign.com/samples/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/hardboileddesignwide.jpg" alt="" /></a></p><p><a
href="http://hardboiledwebdesign.com/samples/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/hardboileddesignsmall.jpg" alt="" /></a></p><p>The layout here adjusts image sizes based on width, as well as shifting columns around for narrower screens.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://artequalswork.com/">Art=Work</a></strong></p><p><a
href="http://artequalswork.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/artworksmall.jpg" alt="" /></a></p><p><a
href="http://artequalswork.com/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/artworkwide.jpg" alt="" /></a></p><p>A great example of a layout where the columns change position for smaller screen resolutions.</p><p><br
class="spacer_" /></p><p><strong><a
href="http://bureau.tsailly.net/">Bureau</a></strong></p><p><a
href="http://bureau.tsailly.net/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/bureauwidest.jpg" alt="" /></a></p><p><a
href="http://bureau.tsailly.net/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/bureaunormal.jpg" alt="" /></a></p><p><a
href="http://bureau.tsailly.net/"><img
src="http://netdna.webdesignerdepot.com/uploads/responsive_web_design/bureausmall.jpg" alt="" /></a></p><p>The Bureau design shifts from a fluid-width design with fixed column  widths for very wide screens to a fixed-width design for most screen  sizes to a different fluid one for narrower widths.</p><p><br
class="spacer_" /></p><p><em>Written exclusively for WDD by <a
href="http://cameronchapman.com/">Cameron Chapman</a>.</em></p><p><em><strong>Have your own take on designing for wider screens and responsive design? Share in the comments!</strong></em></p><style></style><p><br/>If you find an exclusive RSS freebie on this feed or on the live WDD website, please use the following code to download it: O1Rs1S</p><p><br/><br
/><table
width="100%" style="border-top:1px solid #d7d7d7; border-bottom:1px solid #d7d7d7;" height="20"><tr><td
valign="center"> <a
href="http://mightydeals.com/deal/visualfreaks.html?ref=inwidget"><font
face="Arial" size="3" color="#e64f32"><b>Get 4 VisualFreaks Packs for only $29.95 (reg. $119)</b></font></a></td><td
width="90"> <a
href="http://www.mightydeals.com/?ref=inwidget"><br
/> <img
src="http://mightydeals.com/web/images/widget-logo.png" height="40" width="90" border="0"  /><br
/> </a></td></tr></table><p><br/></p> <a
href="http://www.webdesignerdepot.com/2011/05/big-vs-small-challenges-in-responsive-web-design/">Source</a><style type="text/css">p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}</style>
<p><a href="http://feedads.g.doubleclick.net/~a/HPs6CGvqyDGw0nsRnW_Lsq_f5Bw/0/da"><img src="http://feedads.g.doubleclick.net/~a/HPs6CGvqyDGw0nsRnW_Lsq_f5Bw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HPs6CGvqyDGw0nsRnW_Lsq_f5Bw/1/da"><img src="http://feedads.g.doubleclick.net/~a/HPs6CGvqyDGw0nsRnW_Lsq_f5Bw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/webdesignerdepot/~4/OBFHdGCd5Nk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webdesignerdepot.com/2011/05/big-vs-small-challenges-in-responsive-web-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Future Of CSS: Experimental CSS Properties</title>
		<link>http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/</link>
		<comments>http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/#comments</comments>
		<pubDate>Wed, 11 May 2011 11:35:25 +0000</pubDate>
		<dc:creator>Christian Krammer</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.smashingmagazine.com/?p=98915</guid>
		<description><![CDATA[<table width="650"><tr><td width="650"><div style="width:650px;"> <img src="http://statisches.auslieferung.commindo-media-ressourcen.de/advertisement.gif" alt="" border="0" /><br /> <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=34" border="0" alt="" /></a>&#160;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=35" border="0" alt="" /></a>&#160;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=36" border="0" alt="" /></a></div></td></tr></table><p>Despite contemporary browsers supporting a wealth of CSS3 properties, most designers and developers seem to focus on the quite harmless properties such as border-radius, box-shadow or transform. These are well documented, well tested and frequently used, and so it’s almost impossible to not stumble on them these days if you are designing websites.</p><p><a href="http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/title1.jpg" width="500" height="334" alt="Screenshot" /></a></p> <iframe class="facebooklike" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.smashingmagazine.com%2F2011%2F05%2F11%2Fthe-future-of-css-experimental-css-properties%2F&#38;layout=standard&#38;show_faces=false&#38;width=450&#38;action=like&#38;colorscheme=light&#38;height=35" scrolling="no" frameborder="0"></iframe><p>But hidden deep within the treasure chests of browsers are advanced, heavily underrated properties that don’t get that much attention. Perhaps some of them rightly so, but others deserve more recognition. The greatest wealth lies under the hood of WebKit browsers, and in the age of iPhone, iPad and Android apps, getting acquainted with them can be quite useful.</p>]]></description>
			<content:encoded><![CDATA[<table width="650"><tr><td width="650"><div style="width:650px;"> <img src="http://statisches.auslieferung.commindo-media-ressourcen.de/advertisement.gif" alt="Advertisement in The Future Of CSS: Experimental CSS Properties" border="0" /><br /> <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=34" border="0" alt=" in The Future Of CSS: Experimental CSS Properties"  /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=35" border="0" alt=" in The Future Of CSS: Experimental CSS Properties"  /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=36" border="0" alt=" in The Future Of CSS: Experimental CSS Properties"  /></a></div></td></tr></table><p>Despite contemporary browsers supporting a wealth of CSS3 properties, most designers and developers seem to focus on the quite harmless properties such as <code>border-radius</code>, <code>box-shadow</code> or <code>transform</code>. These are well documented, well tested and frequently used, and so it&#8217;s almost impossible to not stumble on them these days if you are designing websites.</p><p>But hidden deep within the treasure chests of browsers are advanced, heavily underrated  properties that don&#8217;t get that much attention. Perhaps some of them rightly so, but others deserve more recognition. The greatest wealth lies under the hood of WebKit browsers, and in the age of iPhone, iPad and Android apps, getting acquainted with them can be quite useful. Even the Gecko engine, used by Firefox and the like, provides some distinct properties. In this article, we wisll look at some of the less known CSS 2.1 and CSS3 properties and their support in modern browsers.</p><p><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/title1.jpg" width="500" height="334" alt="Title1 in The Future Of CSS: Experimental CSS Properties" /></p><p><strong>Some explanation:</strong> For each property, I state the support</strong>: &#8220;<strong>WebKit</strong>&#8221; means that it is available only in browsers that use the WebKit engine (Safari, Chrome, iPhone, iPad, Android), and &#8220;<strong>Gecko</strong>&#8221; indicates the availability in Firefox and the like. Finally, certain properties are part of the official <a href="http://www.w3.org/TR/CSS21"><strong>CSS 2.1.</strong></a> specification, which means that a broad range of browsers, even older ones, support them. Finally, a label of <a href="http://www.w3.org/Style/CSS/current-work"><strong>CSS3</strong></a> indicates adherence to this specification, supported by the latest browser versions, such as Firefox 4, Chrome 10, Safari 5, Opera 11.10 and Internet Explorer 9.</p><h3>WebKit-Only Properties</h3><h4 id="mask">-webkit-mask</h4><p>This property is quite extensive, so a detailed description is beyond the scope of this article and is certainly worth a more detailed examination, especially because it could turn out to be a time-saver in practical applications.</p><p><code>-webkit-mask</code> makes it possible to apply a mask to an element, thereby enabling you to create a cut-out of any shape. The mask can either be a CSS3 gradient or a semi-transparent PNG image. An alpha value of <code>0</code> would cover the underlying element, and <code>1</code> would fully reveal the content behind. Related properties like <code>-webkit-mask-clip</code>, <code>-webkit-mask-position</code> and <code>-webkit-mask-repeat</code> rely heavily on the syntax of the ones from <a href="http://www.w3schools.com/css/pr_background.asp"><code>background</code></a>. For more info, see the <a href="http://www.webkit.org/blog/181/css-masks">Surfin&#8217; Safari blog</a> and the link below.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkitmask.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkitmask2.jpg" alt="Webkitmask2 in The Future Of CSS: Experimental CSS Properties" width="500" height="320" class="alignnone size-full wp-image-98928" /></a></p><p><strong>Example</strong></p><p>Image mask:</p><pre class="brush: css">
.element {
	background: url(img/image.jpg) repeat;
	-webkit-mask: url(img/mask.png);
}
</pre><p><strong>Example</strong></p><p>Gradient mask:</p><pre class="brush: css">
.element2 {
	background: url(img/image.jpg) repeat;
	-webkit-mask: -webkit-gradient(linear, left top, left bottom, from(rgba(0,0,0,1)), to(rgba(0,0,0,0)));
}
</pre><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-SW17">Safari Developer Library</a></p><h4>-webkit-text-stroke</h4><p>One of the shortcomings of CSS borders is that only rectangular ones are possible. A ray of hope is <code>-webkit-text-stroke</code>, which gives text a border. Setting not only the width but the color of the border is possible. And in combination with <code>color: transparent</code>, you can create outlined text.</p><p><strong>Examples</strong></p><p>Assigns a blue border with a 2-pixel width to all <code>&lt;h1&gt;</code> headings:</p><pre class="brush: css">
h1 {-webkit-text-stroke: 2px blue}
</pre><p>Another feature is the ability to smooth text by setting a transparent border of 1 pixel:</p><pre class="brush: css">
h2 {-webkit-text-stroke: 1px transparent}
</pre><p>Creates text with a red outline:</p><pre class="brush: css">
h3 {
	color: transparent;
	-webkit-text-stroke: 4px red;
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkittextstroke.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkittextstroke.jpg" alt="Webkittextstroke in The Future Of CSS: Experimental CSS Properties" width="496" height="53" class="alignnone size-full wp-image-98929" /></a></p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/css/property/-webkit-text-stroke">Safari Developer Library</a></p><h4>-webkit-nbsp-mode</h4><p>Wrapping can be pretty tricky. Sometimes you want text to break (and not wrap) at certain points, and other times you don&#8217;t want this to happen. One property to control this is <code>-webkit-nbsp-mode</code>. It lets you change the behavior of the <code>&amp;nbsp;</code> character, forcing text to break even where it is used. This behavior is enabled by the value <code>space</code>.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266--webkit-nbsp-mode">Safari Developer Library</a></p><h4>-webkit-tap-highlight-color</h4><p>This one is just for iOS (iPhone and iPad). When you tap on a link or a JavaScript clickable element, it is highlighted by a semi-transparent gray background. To override this behavior, you can set <code>-webkit-tap-highlight-color</code> to any color. To disable this highlighting, a color with an alpha value of <code>0</code> must be used.</p><p><strong>Example</strong></p><p>Sets the highlight color to red, with a 50% opacity:</p><pre class="brush: css">
-webkit-tap-highlight-color: rgba(255,0,0,0.5);
</pre><p><strong>Supported by</strong>: iOS only (iPhone and iPad).</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-_webkit_tap_highlight_color">Safari Developer Library</a></p><h4>zoom: reset</h4><p>Normally, <code>zoom</code> is an Internet Explorer-only <a href="http://reference.sitepoint.com/css/zoom">property</a>. But in combination with the value <code>reset</code>, WebKit comes into play (which, funny enough, IE doesn&#8217;t support). It enables you to override the standard behavior of zooming on websites. If set with a CSS declaration, everything except the given element is enlarged when the user zooms on the page.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-SW15">Safari Developer Library</a></p><h4>-webkit-margin-collapse</h4><p>Here is a property with a quite limited practical use, but it is still worth mentioning. By default, the margins of two adjacent elements collapse, which means that the bottom distance of the first element and the top distance of the second element merge into a single gap.</p><p>The best example is two <code>&lt;p&gt;</code>s that share their margins when placed one after another. To control this behavior, we can use <code>-webkit-margin-collapse</code>, <code>-webkit-margin-top-collapse</code> or <code>-webkit-margin-bottom-collapse</code>. The standard value is <code>collapse</code>. The <code>separate</code> value stops the sharing of margins, which means that both the bottom margin of the first element and the top margin of the second are included.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkitmargincollapse.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkitmargincollapse.jpg" alt="Webkitmargincollapse in The Future Of CSS: Experimental CSS Properties" width="495" height="242" class="alignnone size-full wp-image-98927" /></a></p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266--webkit-margin-collapse">Safari Developer Library</a></p><h4>-webkit-box-reflect</h4><p>Do you remember the days when almost every website featured a reflection of either its logo or some text in the header? Thankfully, those days are gone, but if you&#8217;d like to make a subtle use of this technique for your buttons, navigation or other UI elements with CSS, then <code>-webkit-box-reflect</code> is the property for you.</p><p>It accepts the keywords <code>above</code>, <code>below</code>, <code>left</code> and <code>right</code>, which set where the reflection is drawn, as well as a numeric value that sets the distance between the element and its reflection. Beyond that, mask images are supported as well (see <a href="http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/#mask"><code>-webkit-mask</code></a> for an explanation of masks). The reflection is created automatically and has no effect on the layout. Following elements are created using only CSS, and the second button is reflected using the <code>-webkit-box-reflect</code>-property.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkitboxreflect.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/webkitboxreflect.jpg" alt="Webkitboxreflect in The Future Of CSS: Experimental CSS Properties" width="421" height="265" class="alignnone size-full wp-image-98926" /></a></p><p><strong>Examples</strong></p><p>This reflection would be shown under its parent element and have a spacing of 5 pixels:</p><pre class="brush: css">
-webkit-box-reflect: below 5px;
</pre><p>This reflection would be cast on the right side of the element, with no distance (<code>0</code>); additionally, a mask would be applied (<code>url(mask.png)</code>):</p><pre class="brush: css">
-webkit-box-reflect: right 0 url(mask.png);
</pre><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-SW16">Safari Developer Library</a></p><h4>-webkit-marquee</h4><p>Here is another property that recalls the good ol’ days when marquees were quite common. Interesting that this widely dismissed property turns out to be be useful today, when we shift content on tiny mobile screens that would otherwise not be fully visible without wrapping.</p><p>The weather application by <a href="http://i.ozpda.com/ozweather/">ozPDA</a> makes great use of it. (If you don&#8217;t see shifting text, just select another city at the bottom of the app. WebKit browser required.)</p><p><strong>Example</strong></p><pre class="brush: css">
.marquee {
	white-space: nowrap;
	overflow:-webkit-marquee;
	width: 70px;
	-webkit-marquee-direction: forwards;
	-webkit-marquee-speed: slow;
	-webkit-marquee-style: alternate;
}
</pre><p>There are some prerequisites for the marquee to work. First, <code>white-space</code> must be set to <code>nowrap</code> if you want the text to be on one line. Also, <code>overflow</code> must be set to <code>-webkit-marquee</code>, and <code>width</code> set to something narrower than the full length of the text.</p><p>The remaining properties ensure that the text scrolls from left to right (<code>-webkit-marquee-direction</code>), shifts back and forth (<code>-webkit-marquee-style</code>) and moves at a slow rate (<code>-webkit-marquee-speed</code>). Additional properties are <code>-webkit-marquee-repetition</code>, which sets how many iterations the marquee should pass through, and <code>-webkit-marquee-increment</code>, which defines the degree of speed in each increment.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-_webkit_marquee">Safari Developer Library</a></p><h3>Gecko-Only Properties</h3><h4>font-size-adjust</h4><p>Unfortunately, this useful CSS3 property is supported only by Firefox at the moment. We can use it to specify that the font size for a given element should relate to the height of lowercase letters (x-height) rather than the height of uppercase letters (cap height). For example, Verdana is much more legible at the same size than Times, which has a much shorter x-height. To compensate for this behavior, we can adjust the latter with <code>font-size-adjust</code>.</p><p>This property is particularly useful in CSS font stacks whose fonts have different x-heights. Even if you’re careful to use only similar fonts, <code>font-size-adjust</code> can provide a solution when problems arise.</p><p><strong>Example</strong></p><p>If Verdana is not installed on the user&#8217;s machine for some reason, then Arial is adjusted so that it has the same aspect ratio as Verdana, which is 0.58 (at a font size of 12px, differs on other sizes).</p><pre class="brush: css">
p {
	font-family:Verdana, Arial, sans-serif;
	font-size: 12px;
	font-size-adjust: 0.58;
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/fontsizeadjust.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/fontsizeadjust.jpg" alt="Fontsizeadjust in The Future Of CSS: Experimental CSS Properties" width="485" height="78" class="alignnone size-full wp-image-98919" /></a></p><p><strong>Supported by</strong>: Gecko.</p><p><strong>Further reading</strong>: <a href="https://developer.mozilla.org/en/CSS/font-size-adjust">Mozilla Developer Network</a></p><h4>image-rendering</h4><p>A few years ago, images that were not displayed at their original size and were scaled by designers, could appear unattractive or just plain wrong in the browser, depending on the size and context. Nowadays, browsers have a much better algorithm for displaying resized images, however, it&#8217;s great to have a full control over the ways your images will be displayed when scaled, especially with responsive images becoming a de facto standard in responsive Web designs.</p><p>This Gecko-specific property is particularly useful if you have an image with sharp lines and want to maintain them after resizing. The relevant value would be <code>-moz-crisp-edges</code>. The same algorithm is used at <code>optimizeSpeed</code>, whereas <code>auto</code> and <code>optimizeQuality</code> indicate the standard behavior (which is to resize elements with the best possible quality). The <code>image-rendering</code> property can also be applied to <code>&lt;video&gt;</code> and <code>&lt;canvas&gt; </code> elements, as well as background images. It is a CSS3 property, but is currently supported only by Firefox.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/imagerendering.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/imagerendering.jpg" alt="Imagerendering in The Future Of CSS: Experimental CSS Properties" width="500" height="351" class="alignnone size-full wp-image-98920" /></a></p><p>It&#8217;s also worth mentioning <code>-ms-interpolation-mode: bicubic</code>, although it is a proprietary Internet Explorer property. Nevertheless, it enables Internet Explorer 7 to render images at a much higher quality after resizing which is useful because by default this browser handles such tasks pretty poorly.</p><p><strong>Supported by</strong>: Gecko.</p><p><strong>Further reading</strong>: <a href="https://developer.mozilla.org/en/CSS/image-rendering">Mozilla Developer Network</a></p><h4>-moz-border-top-colors</h4><p>This property could be filed under &#8216;eye-candy&#8217;. It allows you to assign different colors to borders that are wider than 1 pixel. Also available are <code>-moz-border-bottom-colors</code>, <code>-moz-border-left-colors</code> and <code>-moz-border-right-colors</code>.</p><p>Unfortunately, there is no condensed version like <code>-moz-border-colors</code> for this property, so the <code>border</code> property must be set in order for it to work, whereas <code>border-width</code> should be the same as the number of the given color values. If it is not, then the last color value is taken for the rest of the border.</p><p><strong>Example</strong></p><p>Below, the element&#8217;s border would have a standard color of orange applied to the left and right side (because <code>-moz-border-left-colors</code> and <code>-moz-border-right-colors</code> are not set). The top and bottom borders have a kind of gradient, with the colors red, yellow and blue.</p><pre class="brush: css">
div {
	border: 3px solid orange;
	-moz-border-top-colors: red yellow blue;
	-moz-border-bottom-colors: red yellow blue;
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/mozbordercolors.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/mozbordercolors.jpg" alt="Mozbordercolors in The Future Of CSS: Experimental CSS Properties" width="421" height="155" class="alignnone size-full wp-image-98921" /></a></p><p><strong>Supported by</strong>: Gecko.</p><p><strong>Further reading</strong>: <a href="https://developer.mozilla.org/en/CSS/-moz-border-top-colors">Mozilla Developer Network</a></p><h3>Mixed Properties</h3><h4>-webkit-user-select and -moz-user-select</h4><p>There might be times when you don&#8217;t want users to be able to select text, whether to protect it from copying or for another reason. One solution is to set <code>-webkit-user-select</code> and <code>-moz-user-select</code> to <code>none</code>. Please use this property with caution: since most users are looking for information that they can copy and store for future reference, this property is neither helpful nor effective. In the end, the user could always look up the source code and take the content even if you have forbidden the traditional copy-and-paste. We do not know why this property exists in both WebKit and Gecko browsers.</p><p><strong>Supported by</strong>: WebKit, Gecko.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266--webkit-user-select">Safari Developer Library</a>, <a href="https://developer.mozilla.org/en/CSS/-moz-user-select">Mozilla Developer Network</a></p><h4>-webkit-appearance and -moz-appearance</h4><p>Ever wanted to easily camouflage an image to look like a radio button? Or an input field to look like a checkbox? Then <code>appearance</code> will come in handy. Even if you wouldn&#8217;t always want to mask a link so that it looks like a button (see example below), it&#8217;s nice to know that you can do it if you want.</p><p><strong>Example</strong></p><pre class="brush: css">
a {
	-webkit-appearance: button;
	-moz-appearance: button;
}
</pre><p><strong>Supported by</strong>: WebKit, Gecko.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-_webkit_appearance">Safari Developer Library</a>, <a href="https://developer.mozilla.org/en/CSS/-moz-appearance">Mozilla Developer Network</a></p><h4>text-align: -webkit-center/-moz-center</h4><p>This is one property (or value, to be exact) whose existence is quite surprising. To center a block-level element, one would usually set <code>margin</code> to <code>0 auto</code>. But you could also set the <code>text-align</code> property of the element&#8217;s container to <code>-moz-center</code> and <code>-webkit-center</code>. You can align left and right with <code>-moz-left</code> and <code>-webkit-left</code> and then <code>-moz-right</code> and <code>-webkit-right</code>, respectively.</p><p><strong>Supported by</strong>: WebKit, Gecko.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-text-align">Safari Developer Library</a>, <a href="https://developer.mozilla.org/en/CSS/text-align">Mozilla Developer Network</a></p><h3>CSS 2.1. Properties</h3><h4>counter-increment</h4><p>How often have you wished you could automatically number an ordered list or all of the headings in an article? Unfortunately, there is still no CSS3 property for that. But let&#8217;s look back to CSS 2.1, in which <code>counter-increment</code> provides a solution. That means it&#8217;s been around for several years, and even supported in Internet Explorer 8. Did you know that? Me neither.</p><p>In conjunction with the <code>:before</code> pseudo-element and the <code>content</code> property, <code>counter-increment</code> can add automatic numbering to any HTML tag. Even nested counters are possible.</p><p><strong>Example</strong></p><p>For numbered headings, first reset the counter to start at 1:</p><pre class="brush: css">
body {counter-reset: thecounter}
</pre><p>Every <code>&lt;h1&gt;</code> would get the prefix &#8220;Section,&#8221; including a counter that automatically increments by <code>1</code> (which is default and can be omitted), where <code>thecounter</code> is the name of the counter:</p><pre class="brush: css">
.counter h1:before {
	counter-increment: thecounter 1;
	content:"Section"counter(thecounter)":";
}
</pre><p><strong>Example</strong></p><p>For a nested numbered list, the counter is reset and the automatic numbering of <code>&lt;ol&gt;</code> is switched off because it features no nesting:</p><pre class="brush: css">
ol {
    counter-reset: section;
    list-style-type: none;
}
</pre><p>Then, every <code>&lt;li&gt;</code> is given automatic incrementation, and the separator is set to be a point (.), followed by a blank.</p><pre class="brush: css">
li:before {
    counter-increment: section;
    content: counters(section,".")"";
}
</pre><pre class="brush: xml">&lt;ol&gt;
	&lt;li&gt;item&lt;/li&gt;			&lt;!-- 1 --&gt;
	&lt;li&gt;item				  &lt;!-- 2 --&gt;
		&lt;ol&gt;
			&lt;li&gt;item&lt;/li&gt;	&lt;!-- 1.1 --&gt;
			&lt;li&gt;item&lt;/li&gt;	&lt;!-- 1.2 --&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;item&lt;/li&gt;			&lt;!-- 3 --&gt;
&lt;ol&gt;
</pre><p><strong>Supported by</strong>: CSS 2.1., all modern browsers, IE 7+.</p><p><strong>Further reading</strong>: <a href="http://www.w3.org/TR/CSS21/generate.html#counters">W3C</a></p><h4>quotes</h4><p>Are you tired of using wrong quotes just because your CMS doesn&#8217;t know how to properly convert them to the right ones? Then start using the <code>quotes</code> property to set them how you want. This way, you can use any character. You would then assign the quotes to the desired element using the <code>:before</code> and <code>:after</code> pseudo-elements. Unfortunately, the otherwise progressive WebKit browsers don&#8217;t support this property, which means no quotes are shown at all.</p><p><strong>Example</strong></p><p>The first two characters determine the quotes for the first level of a quotation, the last two for the second level, and so on:</p><pre class="brush: css">
q {
	quotes: '«' '»' "‹" "›";
}
</pre><p>These two lines assign the quotes to the selected element:</p><pre class="brush: css">
q:before {content: open-quote}
q:after  {content: close-quote}
</pre><p>So, <code>&lt;p&gt;&lt;q&gt;This is a very &lt;q&gt;nice&lt;/q&gt; quote.&lt;/q&gt;&lt;/p&gt; </code> would give us:<br /> <strong>«This is a very ‹nice› quote.»</strong></p><p><strong>Supported by</strong>: CSS 2.1., all browsers except WebKit, even IE 7+.</p><p><strong>Further reading</strong>: <a href="http://www.w3.org/TR/CSS2/generate.html#quotes">W3C</a></p><p><strong>Question:</strong> To add the character directly, does the CSS document have to have a UTF-8 character set? That&#8217;s a tough one. Unfortunately, I can&#8217;t give a definitive answer. My experimentation has shown that no character set has to be set for the <code>quotes</code> property to work properly. However the <code>utf-8</code> character set doesn&#8217;t work because it shows “broken” characters (for example, “»”). With the <code>iso-8859-1</code> character set, everything works fine.</p><p>This is how the W3C <a href="http://www.w3.org/TR/CSS21/generate.html">describes it</a>: “While the quotation marks specified by ‘quotes’ in the previous examples are conveniently located on computer keyboards, high-quality typesetting would require different ISO 10646 characters.”</p><h3>CSS3 Properties You May Have Heard About But Can&#8217;t Remember</h3><p>To round out things, let&#8217;s go over some CSS3 properties that are not well known and maybe not as appealing as the classic ones <code>border-radius</code> and <code>box-shadow</code>.</p><h4>text-overflow</h4><p>Perhaps you&#8217;re familiar with this problem: a certain area is too small for the text that it contains, and you have to use JavaScript to cut the string and append “…” so that it doesn&#8217;t blow out the box.</p><p>Forget that! With CSS3 and <code>text-overflow: ellipsis</code>, you can force text to automatically end with “…” if it is longer than the width of the container. The only requirement is to set <code>overflow</code> to <code>hidden</code>. Unfortunately, this is not supported by Firefox but will hopefully be implemented in a coming release.</p><p><strong>Example</strong></p><pre class="brush: css">
div {
	width: 100px;
	text-overflow: ellipsis;
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/textoverflow.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/textoverflow.jpg" alt="Textoverflow in The Future Of CSS: Experimental CSS Properties" width="500" height="190" class="alignnone size-full wp-image-98924" /></a></p><p><strong>Supported by</strong>: CSS 3, all browsers except Firefox, even IE6+.</p><p><strong>Further reading</strong>: <a href="http://www.w3.org/TR/2010/WD-css3-text-20101005/#text-overflow">W3C</a></p><h4>word-wrap</h4><p>With text in a narrow column, sometimes portions of it are too long to wrap correctly. Link URLs especially cause trouble. If you don&#8217;t want to hide the overflowing text with <code>overflow: hidden</code>, then you can set <code>word-wrap</code> to <code>break-word</code>, which causes it to break when it reaches the limit of the container.</p><p><strong>Example</strong></p><pre class="brush: css">
div {
	width: 50px;
	word-wrap: break-word;
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/wordwrap.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/wordwrap.jpg" alt="Wordwrap in The Future Of CSS: Experimental CSS Properties" width="484" height="189" class="alignnone size-full wp-image-98930" /></a></p><p><strong>Supported by</strong>: CSS 3, all browsers, even IE6+.</p><p><strong>Further reading</strong>: <a href="http://www.w3.org/TR/2011/WD-css3-text-20110215/#word-wrap">W3C</a></p><h4>resize</h4><p>If you use Firefox or Chrome, then you must have noticed that text areas by default have a little handle in the bottom-right corner that lets you resize them. This standard behavior is achieved by the CSS3 property <code>resize: both</code>.</p><p>But it&#8217;s not limited to text areas. It can be used on any HTML element. The <code>horizontal</code> and <code>vertical</code> values limit the resizing to the horizontal and vertical axes, respectively. The only requirement is that <code>overflow</code> be set to anything other than <code>visible</code>.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/resize.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/resize.jpg" alt="Resize in The Future Of CSS: Experimental CSS Properties" width="443" height="166" class="alignnone size-full wp-image-98922" /></a></p><p><strong>Supported by</strong>: CSS3, all the latest browsers except Opera and Internet Explorer.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-resize">Safari Developer Library</a></p><h4>background-attachment</h4><p>When you assign a background image to an element that is set to <code>overflow: auto</code>, it is fixed to the background and doesn&#8217;t scroll. To disable this behavior and enable the image to scroll with the content, set <code>background-attachment</code> to <code>local</code>.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/backgroundattachment.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/backgroundattachment.jpg" alt="Backgroundattachment in The Future Of CSS: Experimental CSS Properties" width="500" height="213" class="alignnone size-full wp-image-98918" /></a></p><p><strong>Supported by</strong>: CSS 3, all the latest browsers except Firefox.</p><p><strong>Further reading</strong>: <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-background-attachment">Safari Developer Library</a></p><h4>text-rendering</h4><p>With more and more websites rendering fonts via the <code>@font-face</code> attribute, legibility becomes a concern. Problems can occur particularly at small font sizes. While there is still no CSS property to control the subtle details of displaying fonts online, you can enable <a href="http://en.wikipedia.org/wiki/Kerning">kerning</a> and <a href="http://en.wikipedia.org/wiki/Typographic_ligature">ligatures</a> via <code>text-rendering</code>.</p><p> Gecko and WebKit browsers handle this property quite differently. The former enables these features by default, while you have to set it to <code>optimizeLegibility</code> in the latter.</p><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/textrendering.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/textrendering.jpg" alt="Textrendering in The Future Of CSS: Experimental CSS Properties" width="461" height="169" class="alignnone size-full wp-image-98925" /></a></p><p><strong>Supported by</strong>: CSS3, all WebKit browsers and Firefox.</p><p><strong>Further reading</strong>: <a href="https://developer.mozilla.org/en/CSS/text-rendering">Mozilla Developer Network</a></p><h4>transform: rotateX/transform: rotateY</h4><p>If you’ve already dived into CSS3 and transformations a bit, then you’re probably familiar with <code>transform: rotate()</code>, which rotates an element around its z-axis.</p><p>But did you know that it is also possible to spin it “into the deep” (i.e. around its x-axis and y-axis)? These transformations are particularly useful in combination with <code>-webkit-backface-visibility: hidden</code>, if you want to rotate an element and reveal another one at its back. This technique is described by Andy Clarke in his latest book, <em>Hardboiled Web Design</em>, and it can be seen in action on a <a href="http://hardboiledwebdesign.com/v/c18-16">demo page</a>.</p><p><strong>Example</strong></p><p>If you hover over the element, it will turn by 180&#176;, revealing its back:</p><pre class="brush: css">
div:hover {
	transform: rotateY(180deg);
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/rotate.jpg"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/rotate.jpg" alt="Rotate in The Future Of CSS: Experimental CSS Properties" width="425" height="293" class="alignnone size-full wp-image-98923" /></a></p><p><strong>Quick tip:</strong> To just mirror an element, you can either set <code>transform</code> to <code>rotateX(180deg)</code> (and respectively <code>rotateY</code>) or set <code>transform</code> to <code>scaleX(-1)</code> (and respectively <code>scaleY</code>).</p><p><strong>Supported by</strong>: CSS3, only WebKit browsers, in combination with <code>-webkit-backface-visibility</code> only Safari and iOS (iPhone and iPad).</p><p><strong>Further reading</strong></strong>: Safari Developer Library (<a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/Functions.html#//apple_ref/doc/uid/TP40007955-SW17">transform: rotate</a>, <a href="http://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-_webkit_backface_visibility">-webkit-backface-visibility</a>)</p><h3>Some Last Words</h3><p>As you hopefully have seen, there are many unknown properties that range from being nice to hav to being very useful. Many of them are still at an experimental stage and may never leave it or even be discarded in future browser releases. Others will hopefully be adopted by all browser manufacturers in coming versions.</p><p>While it is hard to justify using some of them, the WebKit-specific ones are gaining more and more importance with the success of the iOS devices and Android. And of course some CSS3 properties are more or less ready to be used now.</p><p>And if you don&#8217;t like vendor-specific properties, you can see them as experiments that still could be implemented in the code to improve the user experience for users browsing with the modern browsers. By the way, <a href="http://lists.w3.org/Archives/Public/www-validator-css/2011Jan/0020.html">CSS validator</a> from the W3C now also supports vendor-specific properties, which result in warnings rather than errors.</p><p>Happy experimenting!</p><p><em>(al)</em></p><hr /><p><small>© Christian Krammer for <a href="http://www.smashingmagazine.com">Smashing Magazine</a>, 2011. | <a href="http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/">Permalink</a> | <a href="http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/#comments">Post a comment</a> | <a href="http://shop.smashingmagazine.com/" title="Smashing Shop">Smashing Shop</a> | <a href="http://www.smashingmagazine.com/the-smashing-network/" title="Smashing Network">Smashing Network</a> | <a href="http://www.smashingmagazine.com/about/" title="About Us">About Us</a><br/> Post tags: <a href="http://www.smashingmagazine.com/tag/css/" rel="tag">CSS</a>, <a href="http://www.smashingmagazine.com/tag/css-properties/" rel="tag">CSS Properties</a>, <a href="http://www.smashingmagazine.com/tag/future-of-css/" rel="tag">Future of CSS</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://www.smashingmagazine.com/2011/05/11/the-future-of-css-experimental-css-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 handy jQuery mobile tips and snippets to get you started</title>
		<link>http://www.webdesignerdepot.com/2011/05/10-handy-jquery-mobile-tips-and-snippets-to-get-you-started/</link>
		<comments>http://www.webdesignerdepot.com/2011/05/10-handy-jquery-mobile-tips-and-snippets-to-get-you-started/#comments</comments>
		<pubDate>Tue, 10 May 2011 11:48:19 +0000</pubDate>
		<dc:creator>Walter</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.webdesignerdepot.com/?p=23018</guid>
		<description><![CDATA[<a
href='http://rss.buysellads.com/click.php?z=1259940&#038;k=75e07a75487088b1694a6868e9c95d21&#038;a=23018&#038;c=532631561' target='_blank'><img
src='http://rss.buysellads.com/img.php?z=1259940&#038;k=75e07a75487088b1694a6868e9c95d21&#038;a=23018&#038;c=532631561' border='0' alt='' /></a><p><a
href='http://buysellads.com/buy/sitedetails/pubkey/75e07a75487088b1694a6868e9c95d21/zone/1259940' target='_blank'>Advertise here with BSA</a></p><br
/>As with any new technology, getting started is often the hardest part. With this frustration in mind, we have put together some of my handiest tips, tricks and code snippets related to the jQuery Mobile library. Because this is not a full-on primer for using the library, we will skip over some of the things [...]]]></description>
			<content:encoded><![CDATA[<a
href='http://rss.buysellads.com/click.php?z=1259940&k=75e07a75487088b1694a6868e9c95d21&a=23018&c=322455288' ><img
src='http://rss.buysellads.com/img.php?z=1259940&k=75e07a75487088b1694a6868e9c95d21&a=23018&c=322455288' border='0' alt='' /></a><p><a
href='http://buysellads.com/buy/sitedetails/pubkey/75e07a75487088b1694a6868e9c95d21/zone/1259940' >Advertise here with BSA</a></p><br
/><p><img
class="alignleft" src="http://netdna.webdesignerdepot.com/uploads/jquery_mobile/200-160-jquery-mobile-tips.png" alt="" width="200" height="160" />As with any new technology, getting started is often the hardest  part.</p><p>With this frustration in mind, we have put together some of my  handiest tips, tricks and code snippets related to the <a
href="http://jquerymobile.com/">jQuery Mobile library</a>.</p><p>Because this is not a full-on primer for using the library, we will  skip over some of the things that become rather obvious as you get  started and instead get straight to the items that become rather  frustrating or troublesome.</p><p>Also be sure to let us know in the comments which snippets you found useful and of any others that you know of that can be useful.<span
id="more-23018"></span></p><h1>1. A full basic page</h1><p>I find myself needing the full mark-up for a basic page over and over  again. As such, here is all the code you need to set up a basic single  page.</p><pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Page Title&lt;/title&gt;
&lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /&gt;
&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div data-role="page" id="home"&gt;
 &lt;div data-role="header"&gt;
  &lt;h1&gt;Header&lt;/h1&gt;
 &lt;/div&gt;
 &lt;div data-role="content"&gt;
  &lt;p&gt;Content goes here&lt;/p&gt;
 &lt;/div&gt;
 &lt;div data-role="footer"&gt;
  &lt;h4&gt;Footer&lt;/h4&gt;
 &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre><p><img
src="http://netdna.webdesignerdepot.com/uploads/jquery_mobile/01-2-full-page.png" alt="" width="254" height="500" /></p><p><br
class="spacer_" /></p><h1>2. Where to add traditional jQuery calls</h1><p>When I got started using this awesome extension to jQuery, I  immediately found myself wanting to modify things on the page before the  mobile plug-in was triggered.</p><p>As it turns out, the recommended solution  is to simply put traditional jQuery calls before the reference that  loads the mobile plug-in. This way, your jQuery commands have a chance  to run prior to the library being loaded. Here is the pattern to follow:</p><pre><code>&lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /&gt;
&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
 $(document).ready(function() {
  // Your jQuery commands go here before the mobile reference
 });
&lt;/script&gt;
&lt;script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"&gt;&lt;/script&gt;</code></pre><p><img
src="http://netdna.webdesignerdepot.com/uploads/jquery_mobile/02-custom-jquery.png" alt="" width="615" height="243" /></p><p><br
class="spacer_" /></p><h1>3. Disable AJAX navigation for all links at once</h1><p>As awesome as AJAX navigation is, there are times where you’d just  rather disable it. Use this bit of jQuery to tell the mobile library not  to use AJAX navigation.</p><p>Place it <em>after</em> the reference to the  jQuery mobile library in the header of the page. In other words, the  library must already be loaded before this code is referenced.</p><pre><code>&lt;script&gt;
 $(document).ready(function() {
  // disable ajax nav
  $.mobile.ajaxLinksEnabled = false;
 });
&lt;/script&gt;</code></pre><p><img
src="http://netdna.webdesignerdepot.com/uploads/jquery_mobile/03-disable-ajax.png" alt="" width="615" height="149" /></p><p><br
class="spacer_" /></p><h1>4. Stop some key items from being truncated</h1><p>One feature of the library (or flaw, depending on your needs) is that  it intelligently truncates long items to fit into UI elements.</p><p>I have  found two situations where this can be annoying. First, in list items,  where I prefer to see the full text. And secondly, in the footer text.  It seems once you have more than just a few characters down there, it  starts getting truncated with “…”. Use this simple CSS to override both  of these defaults.</p><p>For list items:</p><pre><code>body .ui-li .ui-li-desc {
 white-space: normal;
 }</code></pre><p>For footer content:</p><pre><code>body .ui-footer .ui-title {
 white-space: normal;
 }

</code></pre><h1>5. Use media queries to target devices</h1><p>One of the first questions I had with this library was how to target  devices in the CSS (based on screen size). For example, I wanted a  two-column layout for the iPad and a single column for smartphones. The  absolute best way to accomplish this is with media queries.</p><p>With some simple media queries in place, you can quickly make the CSS  target screen sizes. And with this type of targeting, we can quickly  set up different layouts based on the available screen space by relying  on conventional CSS techniques.</p><p>Two fantastic resources for this are:</p><ul
class="tight_list"><li>“<a
href="http://css-tricks.com/css-media-queries/">CSS Media Queries and Using Available Space</a>,” CSS-Tricks;</li><li><a
href="http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries">Hardboiled CSS3 Media Queries</a>,” Stuff and Nonsense.</li></ul><p><br
class="spacer_" /></p><h1>6. Target platforms with jQuery</h1><p>Much as we might want to execute certain CSS for certain devices, we  might also want to run jQuery only on specific devices. Here is an  adaptation of <a
href="http://snipplr.com/view/31607/iphone-ipad-ipod-detect/">some code from Snipplr</a> that allows me to easily segment portions of jQuery to run depending on the user’s device.</p><pre><code> var deviceAgent = navigator.userAgent.toLowerCase();
 var agentID = deviceAgent.match(/(iphone|ipod|ipad|android)/);
 if(agentID.indexOf("iphone")&gt;=0){
  alert("iphone");
 }
 if(agentID.indexOf("ipod")&gt;=0){
  alert("ipod");
 }
 if(agentID.indexOf("ipad")&gt;=0){
  alert("ipad");
 }
 if(agentID.indexOf("android")&gt;=0){
  alert("android");
 }

</code></pre><h1>7. Use full paths for the targets of form action attributes</h1><p>One quirk of the library seems to be its difficulty in finding target  pages to post forms to… that is, unless you use the full path from the  root of the website.</p><p>For example, I’ve found that this form tag never finds its target:</p><pre><code>&lt;form action=" form-handler.php " method="get" &gt;</code></pre><p>Whereas a full path like this works as expected:</p><pre><code>&lt;form action="/current-directory/form-handler.php" method="get" &gt;</code></pre><p>Also, be sure that the results from the form handler produce a full, valid jQuery mobile page, as shown in tip #1.</p><p><br
class="spacer_" /></p><h1>8. Create pop-up dialogs</h1><p>One handy feature of the library is its built-in pop-up or dialog box  feature. Setting up this handy feature is dead simple. Basically, add  an attribute to link to, as follows: <code>data-rel="dialog"</code>.</p><p>Note two things. First, the target page must be a full-blown jQuery  mobile page, as outlined in tip #1. Secondly, this will only work for  external pages; it must be a full separate page to work properly.</p><pre><code>&lt;a href="#pop.html" data-rel="dialog"&gt;Pop up!&lt;/a&gt; </code></pre><p><img
src="http://netdna.webdesignerdepot.com/uploads/jquery_mobile/04-2-dialog.png" alt="" width="254" height="500" /></p><p><br
class="spacer_" /></p><h1>9. A “Cancel” + “Save” button combo</h1><p>This bit of code accommodates two basic needs. The first is to have  two buttons next to each other. Fortunately, the library has a built-in  column structure that can easily be put to work using a fieldset tag and  the proper classes, as seen below. The second is to have two buttons  with different themes. This code is directly <a
href="http://jquerymobile.com/demos/1.0a3/#docs/content/content-grids.html">from the documentation</a>, and I keep it handy for frequent use.</p><pre><code>&lt;fieldset&gt;
 &lt;div&gt;&lt;button type="submit" data-theme="c"&gt;Cancel&lt;/button&gt;&lt;/div&gt;
 &lt;div&gt;&lt;button type="submit" data-theme="b"&gt;Submit&lt;/button&gt;&lt;/div&gt;
&lt;/fieldset&gt;</code></pre><p><img
src="http://netdna.webdesignerdepot.com/uploads/jquery_mobile/05-2-save-cancel.png" alt="" width="254" height="500" /></p><p><br
class="spacer_" /></p><h1>10. Create a column structure on your own</h1><p>In my quest to optimally structure a single page for multiple  devices, I found myself combining the media query tricks above with the  “columns in any order” technique.</p><p>Fortunately, web developers figured  out long ago how to move columns around. By combining this technique  with media queries, we can very easily set up various structures  depending on the screen size we’re working with.</p><p><a
href="http://www.positioniseverything.net/articles/onetruelayout/anyorder">Position Is Everything</a> lays out one of the easiest systems to work with.</p><p><br
class="spacer_" /></p><h1>Conclusion</h1><p>The jQuery mobile library is a blast to work with. It produces  fantastic results with very little effort. And considering it is still  in alpha, it is off to a great start. Hopefully, these quick tips will  keep you moving forward as you dig into this new library.</p><p><br
class="spacer_" /></p><p><em>Written exclusively for WDD by Patrick McNeil. He is a freelance writer, developer and designer. In particular, he loves  to write about web design, train people on web development and build  websites. Patrick’s latest book project is <a
href="http://thewebdesignersideabook.com/books/the-designers-web-handbook/">The Designer’s Web Handbook</a>; learn about his other books on <a
href="http://thewebdesignersideabook.com/">TheWebDesignersIdeaBook.com</a>. Follow Patrick on Twitter <a
href="http://twitter.com/#%21/designmeltdown/">@designmeltdown</a>.</em></p><p><em><strong>What do you think of the jQuery Mobile framework? What handy code snippets have you found useful?</strong></em></p><ul></ul><style></style><p><br/>If you find an exclusive RSS freebie on this feed or on the live WDD website, please use the following code to download it: O1Rs1S</p><p><br/><br
/><table
width="100%" style="border-top:1px solid #d7d7d7; border-bottom:1px solid #d7d7d7;" height="20"><tr><td
valign="center"> <a
href="http://mightydeals.com/deal/visualfreaks.html?ref=inwidget"><font
face="Arial" size="3" color="#e64f32"><b>Get 4 VisualFreaks Packs for only $29.95 (reg. $119)</b></font></a></td><td
width="90"> <a
href="http://www.mightydeals.com/?ref=inwidget"><br
/> <img
src="http://mightydeals.com/web/images/widget-logo.png" height="40" width="90" border="0"  /><br
/> </a></td></tr></table><p><br/></p> <a
href="http://www.webdesignerdepot.com/2011/05/10-handy-jquery-mobile-tips-and-snippets-to-get-you-started/">Source</a><style type="text/css">p img {display:inline-block; margin-right:10px;}
.alignleft {float:left;}
p.showcase {clear:both;}
body#browserfriendly p, body#podcast p, div#emailbody p{margin:0;}</style>
<p><a href="http://feedads.g.doubleclick.net/~a/MRgBKwW0xWCf8YgHARVvTu_mpdg/0/da"><img src="http://feedads.g.doubleclick.net/~a/MRgBKwW0xWCf8YgHARVvTu_mpdg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/MRgBKwW0xWCf8YgHARVvTu_mpdg/1/da"><img src="http://feedads.g.doubleclick.net/~a/MRgBKwW0xWCf8YgHARVvTu_mpdg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/webdesignerdepot/~4/c4DRF-z7LUM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.webdesignerdepot.com/2011/05/10-handy-jquery-mobile-tips-and-snippets-to-get-you-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New WordPress Power Tips For Template Developers And Consultants</title>
		<link>http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/</link>
		<comments>http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/#comments</comments>
		<pubDate>Tue, 10 May 2011 08:41:02 +0000</pubDate>
		<dc:creator>Jacob Goldman</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.smashingmagazine.com/?p=95687</guid>
		<description><![CDATA[<table width="650"><tr><td width="650"><div style="width:650px;"> <img src="http://statisches.auslieferung.commindo-media-ressourcen.de/advertisement.gif" alt="" border="0" /><br /> <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=34" border="0" alt="" /></a>&#160;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=35" border="0" alt="" /></a>&#160;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" target="_blank"><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=36" border="0" alt="" /></a></div></td></tr></table><p>It has been a big year for WordPress.  If there were still some lingering doubts about its potency as a full-fledged content management system, then the full support for custom taxonomies and custom post types in WordPress 3.0 core should have put them to rest. WordPress 3.1 took those leaps one step further, polishing custom taxonomies with multi-taxonomy query support, polishing custom post types with native template support for archives and feeds, and introducing features (like the “admin bar”) that make it easier to quickly edit and add content from the front end.</p><p><a href="http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/"><img src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/05/sm11.jpg" width="500" height="333" alt="Screenshot" /></a></p> <iframe class="facebooklike" src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.smashingmagazine.com%2F2011%2F05%2F10%2Fnew-wordpress-power-tips-for-template-developers-and-consultants%2F&#38;layout=standard&#38;show_faces=false&#38;width=450&#38;action=like&#38;colorscheme=light&#38;height=35" scrolling="no" frameborder="0"></iframe><p>In the broader community, we’ve seen incredible plug-in suites such as <em>BuddyPress</em> mature, and even the emergence of independent WordPress-dedicated hosting services, such as <em>page.ly</em>. To celebrate WordPress’s progress, let’s review some new tips that can help template developers and consultants up their game even further.</p>]]></description>
			<content:encoded><![CDATA[<table width="650"><tr><td width="650"><div style="width:650px;"> <img src="http://statisches.auslieferung.commindo-media-ressourcen.de/advertisement.gif" alt="Advertisement in New WordPress Power Tips For Template Developers And Consultants" border="0" /><br /> <a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=34" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=34" border="0" alt=" in New WordPress Power Tips For Template Developers And Consultants"  /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=35" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=35" border="0" alt=" in New WordPress Power Tips For Template Developers And Consultants"  /></a>&nbsp;<a href="http://auslieferung.commindo-media-ressourcen.de/www/delivery/ck.php?zoneid=36" ><img src="http://auslieferung.commindo-media-ressourcen.de/www/delivery/avw.php?zoneid=36" border="0" alt=" in New WordPress Power Tips For Template Developers And Consultants"  /></a></div></td></tr></table><p>It has been a big year for WordPress.  If there were still some lingering doubts about its potency as a full-fledged content management system, then the full support for <a href="http://codex.wordpress.org/Taxonomies">custom taxonomies</a> and <a href="http://codex.wordpress.org/Post_Types">custom post types</a> in WordPress 3.0 core should have put them to rest. WordPress 3.1 took those leaps one step further, polishing custom taxonomies with <a href="http://www.wpmods.com/query-multiple-taxonomies-in-wp-3-1">multi-taxonomy query support</a>, polishing custom post types with <a href="http://core.trac.wordpress.org/ticket/13818">native template support for archives and feeds</a>, and introducing features (like the “admin bar”) that make it easier to quickly edit and add content from the front end.</p><p>In the broader community, we’ve seen incredible plug-in suites such as <a href="http://www.buddypress.org">BuddyPress</a> mature, and even the emergence of independent WordPress-dedicated hosting services, such as <a href="http://page.ly">page.ly</a>. To celebrate WordPress’s progress, let’s review some new tips that can help template developers and consultants up their game even further.</p><h4>Foreword for New Developers: What is a “Hook”?</h4><p>Most of these tips take advantage of core WordPress “hooks.” Hooks are points in the code that <strong>allow any number of outside functions to “hook in” and intercept the code</strong> in order to add to or modify behavior at a particular point. Hooks are the fundamental concept that enables virtually all plug-ins. WordPress has two kinds of hooks: actions and filters.</p><p><strong>Action hooks</strong> are intended to allow developers to intercept certain activities and execute some additional functionality. For instance, when a new post is published, the developer may want to add some extra functionality, such as posting the title and a link to Twitter.</p><p><strong>Filter hooks</strong> allow the developer to intercept and <em>modify</em> data that is being processed by WordPress for display or saving. For instance, the developer may want to inject an advertisement into the content before displaying the post on the screen.</p><p>Learn more about hooks on the <a href="http://codex.wordpress.org/Plugin_API">official WordPress codex</a>.</p><h4>The Underused Pagination Function</h4><p>Many great plug-ins are in the official WordPress repository. But using fancy plug-ins to add fairly basic functionality to your theme is often like driving a tractor trailer to go around the block. There’s usually a lighter, smarter way: a bike or even a car. And while plug-ins are a fine solution for consultants who are staging a complete roll-out, they’re awkward solutions for theme developers who want to sell standalone templates.</p><p><a href="http://wordpress.org/extend/plugins/wp-pagenavi/">WP-PageNavi</a> is one of the most popular WordPress plug-ins; and no doubt it is well developed. It is ideal for those who are uncomfortable digging into WordPress code. But did you know that WordPress has a function built right into core that (with a bit of savvy about its parameters) can generate pagination links for everything from comments to post archives to post pages?</p><p>The function in question is <a href="http://codex.wordpress.org/Function_Reference/paginate_links"> <code>paginate_links()</code></a>. (For those who like to fish around in the source, it’s on line 1954 of <em>general-template.php</em> in the <em>wp-includes</em> folder as of WordPress 3.1.)  Believe it or not, this underused function has been around since 2.1. Another function, <a href="http://codex.wordpress.org/Function_Reference/paginate_comments_links"><code>paginate_comment_links()</code></a>, is actually a wrapper for this function that is designed specifically for paging comments, and it has been around since 2.7.</p><p>The function takes an array of parameters that make it versatile enough to use for any kind of paging:</p><ul><li><code>base</code><br /> This is the path for the page number links, not including the pagination-specific part of the URL. The characters <code>%_%</code> will be substituted in that URL for the page-specific part of the URL.</li><li><code>format</code><br /> This is the “page” part of the URL. <code>%#%</code> is substituted for the page number. For example, <code>page/%#%</code> or <code>?page=%#%</code>.</li><li><code>total</code><br /> The total number of pages available.</li><li><code>current</code><br /> The current page number.</li><li><code>show_all</code><br /> Lists all page links, instead of limiting it to a certain number of links to the left and right of the current page.</li><li><code>prev_next</code><br /> Includes the “Previous” and “Next” links (if applicable), just as you might normally do with the <code>previous_posts_link()</code> function.</li><li><code>prev_text</code> and <code>next_text</code><br /> Text to put inside the “Previous” and “Next” links.</li><li><code>end_size</code><br /> The number of page links to show at the end. Defaults to <code>1</code> (e.g. 1 2 3 … 10).</li><li><code>mid_size­</code><br /> The number of pages to show on either side of the current page. Defaults to <code>2</code> (example: 1 … 3 4 5 6 7 … 10).</li><li><code>type</code><br /> Allows you to specify an output style. The default is “plain,” which is just a string of links. Can also be set to list (i.e. <code>ul</code> and <code>li</code> representation of links) and array (i.e. returns an array of page links to be potentially outputted any way you like in code).</li><li>You can also add query arguments and fragments.</li></ul><p>Because the function takes all of the information needed to generate page links, you can use it for pretty much any pagination list, as long as you have some key information, such as the number of pages and the current page. Let’s use this function to generate pagination links for an article archive such as a category or main post index:</p><pre class="brush: php">// get total number of pages
global $wp_query;
$total = $wp_query-&gt;max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total &gt; 1 )  {
     // get the current page
     if ( !$current_page = get_query_var('paged') )
          $current_page = 1;
     // structure of “format” depends on whether we’re using pretty permalinks
     $format = empty( get_option('permalink_structure') ) ? '&amp;page=%#%' : 'page/%#%/';
     echo paginate_links(array(
          'base' =&gt; get_pagenum_link(1) . '%_%',
          'format' =&gt; $format,
          'current' =&gt; $current_page,
          'total' =&gt; $total,
          'mid_size' =&gt; 4,
          'type' =&gt; 'list'
     ));
}
</pre><p>Here&#8217;s the HTML generated by that code on the first of 10 posts pages:</p><pre class="brush: php">
&lt;ul class='page-numbers'&gt;
     &lt;li&gt;&lt;span class='page-numbers current'&gt;1&lt;/span&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class='page-numbers' href='http://mysite.com/page/2/'&gt;2&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class='page-numbers' href='http://mysite.com/page/3/'&gt;3&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class='page-numbers' href='http://mysite.com/page/4/'&gt;4&lt;/a&gt;&lt;/li&gt; 
     &lt;li&gt;&lt;a class='page-numbers' href='http://mysite.com/page/5/'&gt;5&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;span class='page-numbers dots'&gt;...&lt;/span&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class='page-numbers' href='http://mysite.com/page/10/'&gt;10&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a class='next page-numbers' href='http://mysite.com/page/2/'&gt;Next &amp;raquo;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre><p>Here’s a screenshot of the pagination on m62 visualcommunications, built using the <code>em>paginate_links</code> function.</p><p><a href="http://www.m62.net"><img class="alignnone size-full wp-image-97983" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/m62-pages.jpg" alt="M62-pages in New WordPress Power Tips For Template Developers And Consultants" width="500" height="97" /></a></p><h4>“I Wish Posts Were Called Articles For My Client.”</h4><p>Have you ever wished you could change the wording of a built-in menu item or notification? If you’re a bit WordPress-savvy, you may have considered generating your own translations file. But you might not know that you can actually “hook” the translation functions in WordPress, capturing their input and modifying their output.</p><p>Be careful with this one. The code you put in this hook will run every time WordPress runs a string through its translation filters. Complex cases and conditionals could add a considerable amount of overhead, especially when loading pages filled with translation strings, such as the administrative pages. But if you just want to rename one thing that confuses your client (for example, maybe changing “Posts” to “Articles” for that corporate client who doesn’t “blog” yet), then these hooks can be very handy.</p><pre class="brush: php">
// hook the translation filters
add_filter(  'gettext',  'change_post_to_article'  );
add_filter(  'ngettext',  'change_post_to_article'  );

function change_post_to_article( $translated ) {
     $translated = str_ireplace(  'Post',  'Article',  $translated );  // ireplace is PHP5 only
     return $translated;
}
</pre><p><img class="alignnone size-full wp-image-97984" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/translations.jpg" alt="Translations in New WordPress Power Tips For Template Developers And Consultants" width="500" height="115" /></p><h4>Redirect Failed Log-Ins</h4><p>Adding a log-in form to the front end of WordPress is pretty easy. WordPress 3.0 gave us the flexible <a href="http://codex.wordpress.org/Function_Reference/wp_login_form">wp_login_form()</a> function, which displays a log-in form that can be customized with a number of arguments. By default, it will redirect the user back to the current page upon successful authentication, but we can also customize the redirect location.</p><pre class="brush: php">
wp_login_form(array( 'redirect' =&gt; site_url() ));  // will redirect back to the website’s home page
</pre><p>There&#8217;s just one problem: it will only redirect upon successful authentication! If your idea was to hide the default WordPress log-in screen, then sending users who fail at a log-in attempt back to the default log-in screen probably isn’t ideal. Here’s a hook and some code that you can put in your <em>functions.php</em> file that will redirect failed log=ins to any location of your choosing.</p><pre class="brush: php">
add_action( 'wp_login_failed', 'my_front_end_login_fail' );  // hook failed login

function my_front_end_login_fail( $username ) {
     $referrer = $_SERVER['HTTP_REFERER'];  // where did the post submission come from?
     // if there's a valid referrer, and it's not the default log-in screen
     if ( !empty($referrer) &amp;&amp; !strstr($referrer,'wp-login') &amp;&amp; !strstr($referrer,'wp-admin') ) {
          wp_redirect( $referrer . '?login=failed' );  // let's append some information (login=failed) to the URL for the theme to use
          exit;
     }
}
</pre><h4>Adding Excerpts to Pages</h4><p>With the addition of support for custom post types, content types (including the built-in Post and Page types) are more like abstract objects. Each content type can support any number of core features, such as the HTML editor, titles, featured images and so forth. One of these core features is the “excerpt.” By default, Pages do not support excerpts. Did you know that adding excerpt support to the built-in Page type is as simple as adding a single line of code?</p><pre class="brush: php">
add_action( 'init', 'my_add_excerpts_to_pages' );
function my_add_excerpts_to_pages() {
     add_post_type_support( 'page', 'excerpt' );
}
</pre><p>Technically, that was a couple of lines of code, but many themes already hook <code>init</code>, so the hook might not be necessary.</p><p><img class="alignnone size-full wp-image-97986" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/page-excerpt.jpg" alt="Page-excerpt in New WordPress Power Tips For Template Developers And Consultants" width="500" height="449" /></p><h4>Add Body Classes Based on Special Conditions</h4><p>If a theme is well constructed, then it would use the <a href="http://codex.wordpress.org/Function_Reference/body_class">body_class()</a> function to automatically generate classes for the <code>body</code> tag based on the properties of the page being viewed, like <code>category</code>, <code>category-3</code>, and <code>logged-in</code>.</p><p>Some websites may have sections that should share some styling but aren&#8217;t unified by any of the default classes generated by <code>body_class</code>. Say we want page ID <code>7</code>, category ID <code>5</code> and the archive for the tag <code>neat</code> to share the body class <code>neat-stuff</code>, so that we can add a number of styling properties to them all without cluttering the style sheet.</p><p><img class="alignnone size-full wp-image-97988" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/body-neat-stuff.jpg" alt="Body-neat-stuff in New WordPress Power Tips For Template Developers And Consultants" width="500" height="199" /></p><p>Luckily, we can hook the <code>body_class()</code> output!</p><pre class="brush: php">
add_filter( 'body_class', 'my_neat_body_class');
function my_neat_body_class( $classes ) {
     if ( is_page(7) || is_category(5) || is_tag('neat') )
          $classes[] = 'neat-stuff';

     return $classes; 
}
</pre><h4>“You Can Have Settings Access, But Don’t Say We Didn’t Warn You!”</h4><p>Clients often expect full administrative access (and rightly so), including access to settings pages. Let’s look at how we can hook admin “notices” (those warning boxes generated by some plug-ins) to send some warnings to administrative users when they are on settings pages.</p><pre class="brush: php">
add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen;&lt;/div&gt;
     if ( $current_screen-&gt;parent_base == 'options-general' )
          echo '&lt;div&gt;&lt;p&gt;Warning - changing settings on these pages may cause problems with your website’s design!&lt;/p&gt;&lt;/div&gt;';
}
</pre><p><img class="alignnone size-full wp-image-97990" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/warning-settings.jpg" alt="Warning-settings in New WordPress Power Tips For Template Developers And Consultants" width="500" height="85" /></p><h4>Remove the “Links” Menu Item</h4><p>With WordPress increasingly being used for full website implementations, the blog roll and links feature is being used less and less. Thankfully, a new, <a title="remove_menu_page function in WordPress" href="http://codex.wordpress.org/Function_Reference/remove_menu_page">little-known function</a> added in WordPress 3.1 makes it very easy to remove unwanted menu items such as “Links.”</p><pre class="brush: php">
add_action( 'admin_menu', 'my_admin_menu' );

function my_admin_menu() {
     remove_menu_page('link-manager.php');
}
</pre><p><img class="alignnone size-full wp-image-97992" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/no-links.jpg" alt="No-links in New WordPress Power Tips For Template Developers And Consultants" width="154" height="126" /></p><h4>Take Out the Dashboard News Feeds… and Add a New One of Your Own</h4><p>If you build WordPress websites for clients, then the number of WordPress news feeds loaded by default in the dashboard might be an annoyance. If you’re clever, you might just inject some of your own client’s news.</p><pre class="brush: php">
add_action('wp_dashboard_setup', 'my_dashboard_widgets');
function my_dashboard_widgets() {
     global $wp_meta_boxes;
     // remove unnecessary widgets
     // var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs
     unset(
          $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']
     );
     // add a custom dashboard widget
     wp_add_dashboard_widget( 'dashboard_custom_feed', 'News from 10up', 'dashboard_custom_feed_output' ); //add new RSS feed output
}
function dashboard_custom_feed_output() {
     echo '&lt;div class="rss-widget"&gt;';
     wp_widget_rss_output(array(
          'url' =&gt; 'http://www.get10up.com/feed',
          'title' =&gt; 'What\'s up at 10up',
          'items' =&gt; 2,
          'show_summary' =&gt; 1,
          'show_author' =&gt; 0,
          'show_date' =&gt; 1 
     ));
     echo "&lt;/div&gt;";
}
</pre><p><a href="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/10up-news.jpg"><img class="alignnone size-full wp-image-97994" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/10up-news.jpg" alt="10up-news in New WordPress Power Tips For Template Developers And Consultants" width="500" height="220" /></a></p><h4>Add Your Own Credits to the Administrative Footer</h4><p>If you build WordPress websites for clients, then you should certainly make sure that WordPress gets its due. It wouldn’t hurt to sneak in a little credit to your agency either.</p><pre class="brush: php">
add_filter( 'admin_footer_text', 'my_admin_footer_text' );
function my_admin_footer_text( $default_text ) {
     return '&lt;span id="footer-thankyou"&gt;Website managed by &lt;a href="http://www.get10up.com"&gt;10up&lt;/a&gt;&lt;span&gt; | Powered by &lt;a href="http://www.wordpress.org"&gt;WordPress&lt;/a&gt;';
}
</pre><p><img class="alignnone size-full wp-image-97997" src="http://media.smashingmagazine.com/cdn_smash/wp-content/uploads/2011/04/admin-footer.jpg" alt="Admin-footer in New WordPress Power Tips For Template Developers And Consultants" width="500" height="66" /></p><h4>Further Reading</h4><p>Here are more tips for developers who build websites for clients:</p><ul><li><a href="http://www.get10up.com/blog/2011/03/customizing-wordpress-admin/">Customizing WordPress Administration with Twenty-Ten Child Theme</a></li><li><a href="http://sixrevisions.com/wordpress/10-techniques-for-customizing-the-wordpress-admin-panel/">10 Techniques for Customizing the WordPress Admin Panel</a></li></ul><p>More WordPress power tips from Smashing Magazine:</p><ul><li><a href="http://www.smashingmagazine.com/2009/12/14/advanced-power-tips-for-wordpress-template-developers-reloaded/">Advanced Power Tips for WordPress Template Developers: Reloaded</a></li><li><a href="http://www.smashingmagazine.com/2009/11/25/advanced-power-tips-for-wordpress-template-developers/">Advanced Power Tips for WordPress Template Developers</a></li><li><a href="http://www.smashingmagazine.com/2009/07/02/power-tips-for-wordpress-template-developers/">Power Tips for WordPress Template Developers</a></li></ul><p><em>(al) (il)</em></p><hr /><p><small>© Jacob Goldman for <a href="http://www.smashingmagazine.com">Smashing Magazine</a>, 2011. | <a href="http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/">Permalink</a> | <a href="http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/#comments">Post a comment</a> | <a href="http://shop.smashingmagazine.com/" title="Smashing Shop">Smashing Shop</a> | <a href="http://www.smashingmagazine.com/the-smashing-network/" title="Smashing Network">Smashing Network</a> | <a href="http://www.smashingmagazine.com/about/" title="About Us">About Us</a><br/> Post tags: <a href="http://www.smashingmagazine.com/tag/action-hooks/" rel="tag">action hooks</a>, <a href="http://www.smashingmagazine.com/tag/filter-hooks/" rel="tag">filter hooks</a>, <a href="http://www.smashingmagazine.com/tag/pagination-function/" rel="tag">Pagination Function</a>, <a href="http://www.smashingmagazine.com/tag/wordpress/" rel="tag">wordpress</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Win a Free MacBook Pro and $1,000 in Printing From UPrinting</title>
		<link>http://feedproxy.google.com/~r/nettuts/~3/nszpsS3wLyg/</link>
		<comments>http://feedproxy.google.com/~r/nettuts/~3/nszpsS3wLyg/#comments</comments>
		<pubDate>Mon, 09 May 2011 16:00:26 +0000</pubDate>
		<dc:creator>Grant Friedman</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://net.tutsplus.com/?p=19916</guid>
		<description><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=19916&#038;c=15199517' target='_blank'><img src='http://rss.buysellads.com/img.php?z=1260013&#038;k=d754f1e9ba63a736ba8ff5ece958f7dd&#038;a=19916&#038;c=15199517' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' target='_blank'>Advertise here</a></p><p>Hello everyone! Today we&#8217;ve got a special treat for you. Our friends at UPrinting are giving away a free 13 inch MacBook Pro (valued at $1,199) and $1,000 worth of printing to 1 lucky Tuts+ reader. To win, all you have to do is answer a simple question  and submit it using the form below.</p>
<p><span id="more-19916"></span></p>
<div class="tutorial_image"><img src="http://psdtuts.s3.amazonaws.com/0684_Mbp_Giveaway/mbp.jpg" width="600" height="328"></div>
<p>While I am sure most of you are skimming through this text to find details on how you can enter, we would like to tell you a bit more about UPrinting before you do. UPrinting is a socially responsible <a href="http://www.uprinting.com/">online printing</a>, marketing and technology firm with a distinct vision and clear approach to helping small businesses grow. It serves thousands of on-demand printing orders online daily, using high-quality printing presses and a robust yet simple and easy-to-use online ordering system, resulting in high-end printing at low costs.</p>
<p>They are also known for high quality print products such as <a href="http://www.uprinting.com/business-cards.html">business cards</a>. The print quality is just amazing, clients usually get praised for the extra effort they have put on their cards! As mentioned earlier, they offer a wide variety of options so customers can choose from rectangular to die-cut shapes and gloss coating to matte.</p>
<p>UPrinting.com has earned customer loyalty by offering more customizable options than other online printer. The company is popular for its Free File Review, a complimentary proofing service that requires no upfront payment. UPrinting.com also offers convenient marketing support such as design services and direct mailing to help the small or medium-sized business grow.</p>
<p>Ok, now that you know a bit more about UPrinting, now I am sure you are wondering a bit more about this giveaway. As stated in the intro, UPrinting is giving away a 13 inch MacBook Pro (valued at $1,199) and $1,000 in printing services to 1 lucky reader. To enter, all you need to do is answer the following question and submit it by following the link below.</p>
<blockquote><p>Which UPrinting print product do you find most useful? Why?</p></blockquote>
<div class="tutorial_image">
<h4><a href="http://www.formstack.com/forms/envato-uprinting_macbook_pro_giveaway">Submit Your Entry Here</a></h4>
</div>
<p><em>* Please note that we will be sharing your name and email address with UPrinting. This means that you may receive emails from them after the conclusion of this giveaway. If you&#8217;re ok with this, you may submit your entry by following the link above.</em></p>
<hr />
<h2>The Prizes</h2>
<ul>
<li>1 MacBook Pro (valued at $1,199) Specs: 13-inch, 2.3 GHz, 2.3GHz dual-core, Intel Core i5, 4GB 1333MHz, 320GB 5400-rpm1, Intel HD Graphics 3000, Built-in battery.</li>
<li>$1000 in printing credits from UPrinting. Valid for one-time use, applicable to printing cost only.</li>
</ul>
<hr />
<h2>Rules</h2>
<ul>
<li>Fill out this form. Tell us which UPrinting print product you find most useful and why.</li>
<li>You may only enter once. Anyone submitting more than once will be disqualified.</li>
<li>Make sure to enter a valid email address so that we can contact you.</li>
<li>Entries will be accepted until Monday, June 6, 2011 at 11:59 PM, EST.</li>
<li>Giveaway is open to all jurisdictions.</li>
<li>You must be of legal age in the jurisdiction that you reside to enter.</li>
<li>Giveaway is void where prohibited.</li>
<li>MacBook Pro shipping free.</li>
<li>Shipping for printing services is free for U.S. residents. Non U.S. residents must pay for shipping for printing services.</li>
<li>Follow UPrinting on <a href="http://twitter.com/uprinting">Twitter</a> of <a href="http://www.facebook.com/uprinting">Facebook</a> (Optional)</li>
<li>Your name and email will be shared with UPrinting at the conclusion of this giveaway. By submitting your entry you consent to receiving correspondence from them.</li>
</ul>
<div class="tutorial_image"><a href="http://www.uprinting.com/"><img src="http://psdtuts.s3.amazonaws.com/0684_Mbp_Giveaway/uprinting_logo.jpg" border="0"></a></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=nszpsS3wLyg:qUJbpl2ug9A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=nszpsS3wLyg:qUJbpl2ug9A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=nszpsS3wLyg:qUJbpl2ug9A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/nszpsS3wLyg" height="1" width="1"/>]]></description>
			<content:encoded><![CDATA[<a href='http://rss.buysellads.com/click.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=19916&c=15199517' ><img src='http://rss.buysellads.com/img.php?z=1260013&k=d754f1e9ba63a736ba8ff5ece958f7dd&a=19916&c=15199517' border='0' alt='' /></a><p><a href='http://buysellads.com/buy/sitedetails/pubkey/d754f1e9ba63a736ba8ff5ece958f7dd/zone/1260013' >Advertise here</a></p><p>Hello everyone! Today we&#8217;ve got a special treat for you. Our friends at UPrinting are giving away a free 13 inch MacBook Pro (valued at $1,199) and $1,000 worth of printing to 1 lucky Tuts+ reader. To win, all you have to do is answer a simple question  and submit it using the form below.</p>
<p><span id="more-19916"></span></p>
<div class="tutorial_image"><img src="http://psdtuts.s3.amazonaws.com/0684_Mbp_Giveaway/mbp.jpg" width="600" height="328"></div>
<p>While I am sure most of you are skimming through this text to find details on how you can enter, we would like to tell you a bit more about UPrinting before you do. UPrinting is a socially responsible <a href="http://www.uprinting.com/">online printing</a>, marketing and technology firm with a distinct vision and clear approach to helping small businesses grow. It serves thousands of on-demand printing orders online daily, using high-quality printing presses and a robust yet simple and easy-to-use online ordering system, resulting in high-end printing at low costs.</p>
<p>They are also known for high quality print products such as <a href="http://www.uprinting.com/business-cards.html">business cards</a>. The print quality is just amazing, clients usually get praised for the extra effort they have put on their cards! As mentioned earlier, they offer a wide variety of options so customers can choose from rectangular to die-cut shapes and gloss coating to matte.</p>
<p>UPrinting.com has earned customer loyalty by offering more customizable options than other online printer. The company is popular for its Free File Review, a complimentary proofing service that requires no upfront payment. UPrinting.com also offers convenient marketing support such as design services and direct mailing to help the small or medium-sized business grow.</p>
<p>Ok, now that you know a bit more about UPrinting, now I am sure you are wondering a bit more about this giveaway. As stated in the intro, UPrinting is giving away a 13 inch MacBook Pro (valued at $1,199) and $1,000 in printing services to 1 lucky reader. To enter, all you need to do is answer the following question and submit it by following the link below.</p>
<blockquote><p>Which UPrinting print product do you find most useful? Why?</p></blockquote>
<div class="tutorial_image">
<h4><a href="http://www.formstack.com/forms/envato-uprinting_macbook_pro_giveaway">Submit Your Entry Here</a></h4>
</div>
<p><em>* Please note that we will be sharing your name and email address with UPrinting. This means that you may receive emails from them after the conclusion of this giveaway. If you&#8217;re ok with this, you may submit your entry by following the link above.</em></p>
<hr />
<h2>The Prizes</h2>
<ul>
<li>1 MacBook Pro (valued at $1,199) Specs: 13-inch, 2.3 GHz, 2.3GHz dual-core, Intel Core i5, 4GB 1333MHz, 320GB 5400-rpm1, Intel HD Graphics 3000, Built-in battery.</li>
<li>$1000 in printing credits from UPrinting. Valid for one-time use, applicable to printing cost only.</li>
</ul>
<hr />
<h2>Rules</h2>
<ul>
<li>Fill out this form. Tell us which UPrinting print product you find most useful and why.</li>
<li>You may only enter once. Anyone submitting more than once will be disqualified.</li>
<li>Make sure to enter a valid email address so that we can contact you.</li>
<li>Entries will be accepted until Monday, June 6, 2011 at 11:59 PM, EST.</li>
<li>Giveaway is open to all jurisdictions.</li>
<li>You must be of legal age in the jurisdiction that you reside to enter.</li>
<li>Giveaway is void where prohibited.</li>
<li>MacBook Pro shipping free.</li>
<li>Shipping for printing services is free for U.S. residents. Non U.S. residents must pay for shipping for printing services.</li>
<li>Follow UPrinting on <a href="http://twitter.com/uprinting">Twitter</a> of <a href="http://www.facebook.com/uprinting">Facebook</a> (Optional)</li>
<li>Your name and email will be shared with UPrinting at the conclusion of this giveaway. By submitting your entry you consent to receiving correspondence from them.</li>
</ul>
<div class="tutorial_image"><a href="http://www.uprinting.com/"><img src="http://psdtuts.s3.amazonaws.com/0684_Mbp_Giveaway/uprinting_logo.jpg" border="0"></a></div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/nettuts?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/nettuts?i=nszpsS3wLyg:qUJbpl2ug9A:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/nettuts?i=nszpsS3wLyg:qUJbpl2ug9A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/nettuts?i=nszpsS3wLyg:qUJbpl2ug9A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/nettuts?a=nszpsS3wLyg:qUJbpl2ug9A:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/nettuts?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/nettuts/~4/nszpsS3wLyg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/nettuts/~3/nszpsS3wLyg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

