<?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>Pixel Acres &#187; Toolbox</title>
	<atom:link href="http://f6design.com/journal/category/toolbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://f6design.com/journal</link>
	<description>Adventures in web and graphic design</description>
	<lastBuildDate>Wed, 16 May 2012 06:50:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A jQuery plugin boilerplate</title>
		<link>http://f6design.com/journal/2012/05/06/a-jquery-plugin-boilerplate/</link>
		<comments>http://f6design.com/journal/2012/05/06/a-jquery-plugin-boilerplate/#comments</comments>
		<pubDate>Sun, 06 May 2012 14:17:46 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/?p=2430</guid>
		<description><![CDATA[I created this boilerplate for a jQuery plugin I&#8217;m working on, and you can use it to kick start your own jQuery plugin development. The features of my boilerplate are: Plugin can be customised using options Setters/Getters for options Private and public methods Callback hooks Plugin instances can be destroyed The boilerplate Here is the [...]]]></description>
			<content:encoded><![CDATA[<p>I created this boilerplate for a jQuery plugin I&#8217;m working on, and you can use it to kick start your own jQuery plugin development. The features of my boilerplate are:</p>
<ul>
<li>Plugin can be customised using options</li>
<li>Setters/Getters for options</li>
<li>Private and public methods</li>
<li>Callback hooks</li>
<li>Plugin instances can be destroyed</li>
</ul>
<h2>The boilerplate</h2>
<p>Here is the bare bones, uncommented boilerplate source code:</p>
<pre class="brush: jscript; title: ; notranslate">/**
 * A jQuery plugin boilerplate.
 * Author: Jonathan Nicol @f6design
 */
;(function($) {
  var pluginName = 'demoplugin';

  function Plugin(element, options) {
    var el = element;
    var $el = $(element);

    options = $.extend({}, $.fn[pluginName].defaults, options);

    function init() {
      // Add any initialization logic here...

      hook('onInit');
    }

    function fooPublic() {
      // Code goes here...
    }

    function option (key, val) {
      if (val) {
        options[key] = val;
      } else {
        return options[key];
      }
    }

    function destroy() {
      $el.each(function() {
        var el = this;
        var $el = $(this);

        // Add code to restore the element to its original state...

        hook('onDestroy');
        $el.removeData('plugin_' + pluginName);
      });
    }

    function hook(hookName) {
      if (options[hookName] !== undefined) {
        options[hookName].call(el);
      }
    }

    init();

    return {
      option: option,
      destroy: destroy,
      fooPublic: fooPublic
    };
  }

  $.fn[pluginName] = function(options) {
    if (typeof arguments[0] === 'string') {
      var methodName = arguments[0];
      var args = Array.prototype.slice.call(arguments, 1);
      var returnVal;
      this.each(function() {
        if ($.data(this, 'plugin_' + pluginName) &amp;&amp; typeof $.data(this, 'plugin_' + pluginName)[methodName] === 'function') {
          returnVal = $.data(this, 'plugin_' + pluginName)[methodName].apply(this, args);
        } else {
          throw new Error('Method ' +  methodName + ' does not exist on jQuery.' + pluginName);
        }
      });
      if (returnVal !== undefined){
        return returnVal;
      } else {
        return this;
      }
    } else if (typeof options === &quot;object&quot; || !options) {
      return this.each(function() {
        if (!$.data(this, 'plugin_' + pluginName)) {
          $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
        }
      });
    }
  };

  $.fn[pluginName].defaults = {
    onInit: function() {},
    onDestroy: function() {}
  };

})(jQuery);</pre>
<p>&#8230;and with liberal comments:</p>
<pre class="brush: jscript; title: ; notranslate">/**
 * A jQuery plugin boilerplate.
 * Author: Jonathan Nicol @f6design
 */
;(function($) {
  // Change this to your plugin name.
  var pluginName = 'demoplugin';

  /**
   * Plugin object constructor.
   * Implements the Revealing Module Pattern.
   */
  function Plugin(element, options) {
    // References to DOM and jQuery versions of element.
    var el = element;
    var $el = $(element);

    // Extend default options with those supplied by user.
    options = $.extend({}, $.fn[pluginName].defaults, options);

    /**
     * Initialize plugin.
     */
    function init() {
      // Add any initialization logic here...

      hook('onInit');
    }

    /**
     * Example Public Method
     */
    function fooPublic() {
      // Code goes here...
    }

    /**
     * Get/set a plugin option.
     * Get usage: $('#el').demoplugin('option', 'key');
     * Set usage: $('#el').demoplugin('option', 'key', value);
     */
    function option (key, val) {
      if (val) {
        options[key] = val;
      } else {
        return options[key];
      }
    }

    /**
     * Destroy plugin.
     * Usage: $('#el').demoplugin('destroy');
     */
    function destroy() {
      // Iterate over each matching element.
      $el.each(function() {
        var el = this;
        var $el = $(this);

        // Add code to restore the element to its original state...

        hook('onDestroy');
        // Remove Plugin instance from the element.
        $el.removeData('plugin_' + pluginName);
      });
    }

    /**
     * Callback hooks.
     * Usage: In the defaults object specify a callback function:
     * hookName: function() {}
     * Then somewhere in the plugin trigger the callback:
     * hook('hookName');
     */
    function hook(hookName) {
      if (options[hookName] !== undefined) {
        // Call the user defined function.
        // Scope is set to the jQuery element we are operating on.
        options[hookName].call(el);
      }
    }

    // Initialize the plugin instance.
    init();

    // Expose methods of Plugin we wish to be public.
    return {
      option: option,
      destroy: destroy,
      fooPublic: fooPublic
    };
  }

  /**
   * Plugin definition.
   */
  $.fn[pluginName] = function(options) {
    // If the first parameter is a string, treat this as a call to
    // a public method.
    if (typeof arguments[0] === 'string') {
      var methodName = arguments[0];
      var args = Array.prototype.slice.call(arguments, 1);
      var returnVal;
      this.each(function() {
        // Check that the element has a plugin instance, and that
        // the requested public method exists.
        if ($.data(this, 'plugin_' + pluginName) &amp;&amp; typeof $.data(this, 'plugin_' + pluginName)[methodName] === 'function') {
          // Call the method of the Plugin instance, and Pass it
          // the supplied arguments.
          returnVal = $.data(this, 'plugin_' + pluginName)[methodName].apply(this, args);
        } else {
          throw new Error('Method ' +  methodName + ' does not exist on jQuery.' + pluginName);
        }
      });
      if (returnVal !== undefined){
        // If the method returned a value, return the value.
        return returnVal;
      } else {
        // Otherwise, returning 'this' preserves chainability.
        return this;
      }
    // If the first parameter is an object (options), or was omitted,
    // instantiate a new instance of the plugin.
    } else if (typeof options === &quot;object&quot; || !options) {
      return this.each(function() {
        // Only allow the plugin to be instantiated once.
        if (!$.data(this, 'plugin_' + pluginName)) {
          // Pass options to Plugin constructor, and store Plugin
          // instance in the elements jQuery data object.
          $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
        }
      });
    }
  };

  // Default plugin options.
  // Options can be overwritten when initializing plugin, by
  // passing an object literal, or after initialization:
  // $('#el').demoplugin('option', 'key', value);
  $.fn[pluginName].defaults = {
    onInit: function() {},
    onDestroy: function() {}
  };

})(jQuery);</pre>
<h2>Usage</h2>
<p>The first thing you&#8217;ll need to do is change the name of the plugin, which is hardcoded as &#8216;demoplugin&#8217;, to something a little more descriptive. After that you should be able to follow the comments in the source code to customise the plugin.</p>
<p>Here are examples of how an end-user would interact with the plugin:</p>
<pre class="brush: jscript; title: ; notranslate">// Initialize plugin with default options.
$('#element').demoplugin();

// Initialize plugin with user defined options.
$('#element').demoplugin({
  option1: 2000,
  option2: 'value',
  callback1: function () { ... }
});

// Call a public method, no arguments.
$('#element').demoplugin('publicFunctionName');

// Call a public method with arguments.
$('#element').demoplugin('publicFunctionName', 'arg1', 'arg2');

// Get a plugin option.
$('#element').demoplugin('option', 'key');

// Set a plugin option after plugin initialization.
$('#element').demoplugin('option', 'key', value);

// Destroy plugin.
$('#element').demoplugin('destroy');</pre>
<h2>Setup options</h2>
<p>It is very useful to be able to customise jQuery plugins on a per instance basis. The boilerplate implements default settings which can be overwritten when the plugin is initialized:</p>
<pre class="brush: jscript; title: ; notranslate">// Default plugin options.
$.fn[pluginName].defaults = {
  color: '#ff0000',
  height: 200
};</pre>
<pre class="brush: jscript; title: ; notranslate">$('#element').demoplugin({
  color: '#0000ff',
  height: 400
});</pre>
<p>Options can also be overwritten after the plugin is initialized, using the <code>option</code> method:</p>
<pre class="brush: jscript; title: ; notranslate">$('#element').demoplugin('option', 'color', '#00ff00');</pre>
<p>An option value can be fetched using the same method by simply omitting the third parameter:</p>
<pre class="brush: jscript; title: ; notranslate">var color = $('#element').demoplugin('option', 'color');</pre>
<h2>Public and private methods</h2>
<p>Private functions reduce the chance of your users inadvertently calling the plugin&#8217;s utility methods. I&#8217;m a fan of the <a href="http://addyosmani.com/resources/essentialjsdesignpatterns/book/#revealingmodulepatternjavascript">Revealing Module pattern</a>, so that&#8217;s how I chose to implement private/public functionality in my boilerplate.</p>
<pre class="brush: jscript; title: ; notranslate">function Plugin(element, options) {
  // This method is public.
  function fooPublic(param1, param2) {
    // ...
  }

  // This method is private.
  function fooPrivate() {
    // ...
  }

  // Expose methods of Plugin we wish to be public.
  return {
    fooPublic: fooPublic
  };
}</pre>
<p>Public functions can be called by your users like so:</p>
<pre class="brush: jscript; title: ; notranslate">$('#element').demoplugin('fooPublic', 'val1', 'val2');</pre>
<h2>Callback hooks</h2>
<p>Callback hooks are incredibly powerful. They allow your users to listen for events in your plugin&#8217;s behaviour and respond accordingly. Hooks are implemented as functions in the default options object:</p>
<pre class="brush: jscript; title: ; notranslate">$.fn[pluginName].defaults = {
  onSlideshowFinished: function() {}
};</pre>
<p>Each function is empty to begin with, since the callback&#8217;s behaviour will be defined by the user. This is done by overwriting the callback function when setting the plugin&#8217;s options. The scope of the callback is the DOM element the plugin is attached to, so in the following example the DOM element would be hidden.</p>
<pre class="brush: jscript; title: ; notranslate">$('#element').demoplugin({
  onSlideshowFinished: function() {
    $(this).hide();
  }
});</pre>
<p>To trigger a hook, call the plugin&#8217;s <code>hook</code> method:</p>
<pre class="brush: jscript; title: ; notranslate">hook('onSlideshowFinished');</pre>
<p>There are two callbacks implemented by default in the boilerplate: <code>onInit</code> and <code>onDestroy</code>.</p>
<h2>Destroying a plugin instance</h2>
<p>Your users can remove an instance of the plugin by calling its <code>destroy</code> method:</p>
<pre class="brush: jscript; title: ; notranslate">$('#element').demoplugin('destroy');</pre>
<p>The plugin stores all its functionality in its DOM element&#8217;s <code>data</code> object. By default the <code>destroy</code> method simply removes the stored <code>data</code> values. You will probably need to customise <code>destroy</code> to restore the DOM element to its original state and remove any event handlers your plugin has created.</p>
<h2>Credit</h2>
<p>My boilerplate takes inspiration from a number of sources, most notably the jQuery <a href="http://docs.jquery.com/Plugins/Authoring">plugin authoring guidelines</a>, Stefan Gabos&#8217; <a href="http://stefangabos.ro/jquery/jquery-plugin-boilerplate-oop/">boilerplate</a>, and Zeno Rocha and Addy Osmani&#8217;s <a href="http://jqueryboilerplate.com/">jQuery Boilerplate</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2012/05/06/a-jquery-plugin-boilerplate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FormBuilder updated to v1.5</title>
		<link>http://f6design.com/journal/2011/07/18/formbuilder-updated-to-v1-5/</link>
		<comments>http://f6design.com/journal/2011/07/18/formbuilder-updated-to-v1-5/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 07:10:26 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/?p=2079</guid>
		<description><![CDATA[It&#8217;s been almost exactly four years since I updated my FormBuilder PHP class, but believe it or not I have been slowly modifying and improving the class during the intervening years. I figured it was high time I rolled those improvements into the public version of the class, so here&#8217;s what&#8217;s new in version 1.5 [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been almost exactly four years since I updated my <a href="http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/">FormBuilder</a> PHP class, but believe it or not I have been slowly modifying and improving the class during the intervening years. I figured it was high time I rolled those improvements into the public version of the class, so here&#8217;s what&#8217;s new in version 1.5 of FormBuilder:</p>
<ul>
<li>Better handling of checkbox results in the <code>emailResults</code> method.</li>
<li>A custom form submit URL can be passed to the FormBuilder constructor. Useful when using FormBuilder in an environment that is performing URL rewriting.</li>
<li>Replaced deprecated <code>ergei</code> functions with <code>preg_match</code>.</li>
<li>Checkbox field types are correctly processed when field is not mandatory, and the user didn&#8217;t check any of the available options.</li>
<li>Added new field type: file (for file uploads). Note that files are currently <em>not</em> emailed when using the <code>emailResults</code> method. Any handling of the uploaded files should be accomplished manually by accessing PHP&#8217;s <code>$_Files</code> array.</li>
<li>The textbox and textarea field types now accept an optional <code>defaultvalue</code> parameter.</li>
<li>Fixed a bug that meant checkboxes had a CSS class of &#8216;fbheckbox&#8217; instead of &#8216;fbcheckbox&#8217;.</li>
</ul>
<p>If you encounter any problems with the new version please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2011/07/18/formbuilder-updated-to-v1-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monokai theme for phpDesigner</title>
		<link>http://f6design.com/journal/2011/04/27/monokai-theme-for-phpdesigner/</link>
		<comments>http://f6design.com/journal/2011/04/27/monokai-theme-for-phpdesigner/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 22:15:42 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/?p=1364</guid>
		<description><![CDATA[Last year I created a port of the Monokai syntax highlighting theme for phpDesigner and posted it in the phpDesigner forums, but I think it deserves a proper home so I&#8217;m archiving it here on Pixel Acres. PHP example: HTML example: CSS example: JavaScript example: I&#8217;m not sure who designed the Monokai theme originally, but [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I created a port of the Monokai syntax highlighting theme for <a href="http://www.mpsoftware.dk/phpdesigner.php">phpDesigner</a> and posted it in the <a href="http://www.facebook.com/topic.php?uid=108672675347&#038;topic=11050">phpDesigner forums</a>, but I think it deserves a proper home so I&#8217;m archiving it here on Pixel Acres.</p>
<h4>PHP example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2011/04/monokai_theme_php.png" alt="" title="monokai_theme_php" width="450" height="389" class="alignnone size-full wp-image-1377" /></p>
<h4>HTML example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2011/04/monokai_theme_html.png" alt="" title="monokai_theme_html" width="450" height="179" class="alignnone size-full wp-image-1378" /></p>
<h4>CSS example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2011/04/monokai_theme_css.png" alt="" title="monokai_theme_css" width="450" height="224" class="alignnone size-full wp-image-1381" /></p>
<h4>JavaScript example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2011/04/monokai_theme_js.png" alt="" title="monokai_theme_js" width="450" height="258" class="alignnone size-full wp-image-1383" /></p>
<p>I&#8217;m not sure who designed the Monokai theme originally, but it has cropped up in <a href="http://macromates.com/">Textmate</a>, <a href="http://notepad-plus-plus.org/">Notepad++</a>, <a href="http://www.sublimetext.com/">Sublime</a> &#8211; where it is the default colour scheme &#8211; and no doubt a bunch of other editors as well.</p>
<p>My version of Monokai is based on a Notepad++ theme, but I have standardised the color of variables (green) and symbols (white) across all the languages.</p>
<p>I don&#8217;t actually use phpDesigner much these days &#8211; I&#8217;ve jumped ship for <a href="http://www.aptana.com/products/studio3">Aptana Studio 3</a> &#8211; but I still think it is a great code editor, and hopefully someone out there will get some use from my theme.</p>
<h3>Download</h3>
<p><a href="http://f6design.com/projects/f6-monokai-phpd-theme/f6_monokai_phpd_theme.rar">Download Monokai theme for phpDesigner</a></p>
<p>Installation and uninstallation instructions are included with the theme. The theme has syntax highlighting colors for the four languages I work with: HTML, CSS, JavaScript and PHP.</p>
<h3>Important</h3>
<p>There is currently a bug in phpDesigner that sometimes causes the ‘separator’ colors to revert to their defaults (e.g. the color of  tags reverts to black). The only sure-fire way to get things back to normal is to open the phpDesigner preferences dialog, and click ‘OK’.</p>
<p>Apparently this bug will be fixed in the next release of phpDesigner (yay!).</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2011/04/27/monokai-theme-for-phpdesigner/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sunset: A syntax highlighting theme for phpDesigner</title>
		<link>http://f6design.com/journal/2010/09/29/sunset-a-syntax-highlighting-theme-for-phpdesigner/</link>
		<comments>http://f6design.com/journal/2010/09/29/sunset-a-syntax-highlighting-theme-for-phpdesigner/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 07:19:24 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/?p=1057</guid>
		<description><![CDATA[My weapon of choice for code editing is the excellent program phpDesigner, but every so often I like to test drive a different editor to see what I might be missing out on. Recently I spent some time playing with Notepad++, and one feature that jumped out at me was the ability to choose from [...]]]></description>
			<content:encoded><![CDATA[<p>My weapon of choice for code editing is the excellent program <a href="http://www.mpsoftware.dk/">phpDesigner</a>, but every so often I like to test drive a different editor to see what I might be missing out on. Recently I  spent some time playing with <a href="http://notepad-plus-plus.org/">Notepad++</a>, and one feature that jumped out at me was the ability to choose from a large number of pre-installed <a href="http://en.wikipedia.org/wiki/Syntax_highlighting">syntax highlighting</a> themes.</p>
<p>When I switched back to phpDesigner, the default blue-on-white color scheme seemed a tad boring, so I decided it was time to pimp my IDE! Unfortunately user created themes for phpDesigner are thin on the ground, which left me no option but to make my own.</p>
<h4>PHP example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2010/09/sunset_theme_php.png" alt="Sunset theme for phpDesigner - PHP code" width="450" height="389" /></p>
<h4>HTML example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2010/09/sunset_theme_html.png" alt="Sunset theme for phpDesigner - HTML markup" width="450" height="164" /></p>
<h4>CSS example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2010/09/sunset_theme_css.png" alt="Sunset theme for phpDesigner - CSS" width="450" height="224" /></p>
<h4>JavaScript example:</h4>
<p><img src="http://f6design.com/journal/wp-content/uploads/2010/09/sunset_theme_js.png" alt="Sunset theme for phpDesigner - JavaScript code" width="450" height="258" /></p>
<p>I&#8217;ve named my theme Sunset, and it is inspired by the <a href="http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/midnight.html">Midnight theme</a> for <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a>. If any phpDesigner fans are looking for a light-on-dark color scheme to spruce up their code editor, perhaps Sunset will fit the bill.</p>
<h3>Download</h3>
<p><a href="http://www.f6design.com/projects/f6-sunset-phpd-theme/f6_sunset_phpd_theme_1.2.rar">Download Sunset theme for phpDesigner</a></p>
<p>Installation and uninstallation instructions are included with the theme. Currently the theme has syntax highlighting colors for the four languages I work with: HTML, CSS, JavaScript and PHP.</p>
<h3>Important</h3>
<p>There is currently a <a href="http://www.facebook.com/topic.php?topic=12989&#038;post=148620&#038;uid=108672675347">bug in phpDesigner</a> that sometimes causes the &#8216;separator&#8217; colors to revert to their defaults (e.g. the color of <code>&lt;?php ?&gt;</code> tags reverts to black). The only sure-fire way to get things back to normal is to open the phpDesigner preferences dialog, and click &#8216;OK&#8217;. You might also try closing all your open documents and restarting the application. Hopefully this bug will be fixed in a future version of phpDesigner.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2010/09/29/sunset-a-syntax-highlighting-theme-for-phpdesigner/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>FlashScaler now works with SWFObject 2</title>
		<link>http://f6design.com/journal/2008/08/08/flashscaler-now-works-with-swfobject-2/</link>
		<comments>http://f6design.com/journal/2008/08/08/flashscaler-now-works-with-swfobject-2/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 23:23:24 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2008/08/08/flashscaler-now-works-with-swfobject-2/</guid>
		<description><![CDATA[One of my readers, Ren&#233;, asked me if my FlashScaler JavaScript class works with SWFObject 2. I&#8217;m happy to say that yes, it does. The demo and download on my original FlashScaler post now include working examples using SWFObject 2.1.]]></description>
			<content:encoded><![CDATA[<p>One of my readers, Ren&eacute;, asked me if my <a href="http://f6design.com/journal/2006/12/16/scalable-flash-with-scrollbars/#comment-68184">FlashScaler</a> JavaScript class works with SWFObject 2. I&#8217;m happy to say that yes, it does. The demo and download on my original FlashScaler post now include working examples using SWFObject 2.1.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2008/08/08/flashscaler-now-works-with-swfobject-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax form validation using FormBuilder</title>
		<link>http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/</link>
		<comments>http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 00:06:00 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[News & Reviews]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/</guid>
		<description><![CDATA[Over at roScripts there is a nice tutorial explaining how to modify my FormBuilder PHP class so that validation is performed unobtrusively using AJAX. Check it out.]]></description>
			<content:encoded><![CDATA[<p>Over at roScripts there is a <a href="http://www.roscripts.com/Unobtrusive_Ajax_PHP_form_validation-188.html">nice tutorial</a> explaining how to modify my <a href="http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/">FormBuilder PHP</a> class so that validation is performed unobtrusively using AJAX. Check it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Papervision 3D</title>
		<link>http://f6design.com/journal/2007/07/30/papervision-3d/</link>
		<comments>http://f6design.com/journal/2007/07/30/papervision-3d/#comments</comments>
		<pubDate>Mon, 30 Jul 2007 22:41:03 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/07/30/papervision-3d/</guid>
		<description><![CDATA[If you work with Flash at all, by now you will have heard of Papervision 3D, the open source project that has turned the Flash world on its head by introducing a 3rd dimension. I had a quick play with Papervision 3D a few months ago and found it surprising easy to pick up. It [...]]]></description>
			<content:encoded><![CDATA[<p><img class="contentImg matte" src='http://f6design.com/journal/wp-content/uploads/2007/07/papervision_logo.jpg' alt='Papervision 3D logo' /></p>
<p>If you work with Flash at all, by now you will have heard of <a href="http://www.papervision3d.org/">Papervision 3D</a>, the open source project that has turned the Flash world on its head by introducing a 3rd dimension. I had a quick play with Papervision 3D a few months ago and found it surprising easy to pick up. It is now in <a href="http://blog.papervision3d.org/2007/07/07/papervision3d-public-beta/">public beta</a> so I decided to dust off my old project and rewrite it in Actionscript 3.</p>
<h3>3D image gallery demo</h3>
<p><img class="contentImg matte" src='http://f6design.com/journal/wp-content/uploads/2007/07/3dgallery.jpg' alt='Papervision 3D Gallery' /></p>
<p>Inspired by Antti Kupila&#8217;s stunning <a href="http://www.anttikupila.com/development/flame-3d-music-in-actionscript-3/">3D interface for last.fm</a>, I created a simple gallery of album covers using Papervision 3D. For the reflections of the album covers I have used Pixelfumes&#8217; <a href="http://pixelfumes.blogspot.com/2006/06/actionscript-3-reflection-class-source.html">Reflection class</a>.</p>
<h4>View demo</h4>
<p><a href="http://f6design.com/projects/3dgallery/" target="_blank">View my 3D image gallery</a></p>
<h4>Download source</h4>
<p>If you&#8217;re curious to see how I put this demo together, take a look at my <a href="http://f6design.com/projects/3dgallery/3dgallery.zip">Flash source files</a>.</p>
<h3>Using Papervision 3D</h3>
<p>The biggest challenge for me was porting my code to Actionscript 3, as it was the first time I had written AS3 code. But as far as Papervision 3D itself, it really is a piece of cake to get your head around. The documentation that comes with Papervision 3D is a bit hard to follow, but if you download the zipped version of Papervision 3D from <a href="http://code.google.com/p/papervision3d/">Google Code</a> it contains a bunch of great examples which help to introduce the basic concepts.</p>
<p>The cool thing about Papervision is how it can be adapted to all kinds of 3D applications. My main interest is in the possibilities for creating 3D application interfaces, but people have also created <a href="http://www.rockonflash.com/blog/?p=37">3D games</a>, <a href="http://www.papervision3d.org/">models</a> and <a href="http://www.rhythmoflines.co.uk/">animations</a>. Expect to see a lot more 3D Flash in the next couple of years!</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/07/30/papervision-3d/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>File download icon</title>
		<link>http://f6design.com/journal/2007/07/19/file-download-icon/</link>
		<comments>http://f6design.com/journal/2007/07/19/file-download-icon/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 12:30:08 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/07/19/file-download-icon/</guid>
		<description><![CDATA[I spent an hour yesterday sprucing up the &#8216;file download&#8217; icon I use on one of my websites, and I&#8217;m putting my Photoshop file up here for you to use if you like. I&#8217;ve made it very easy to change the color scheme of the icon, or to modify the graphic on its label, so [...]]]></description>
			<content:encoded><![CDATA[<p>I spent an hour yesterday sprucing up the &#8216;file download&#8217; icon I use on one of my websites, and I&#8217;m putting my Photoshop file up here for you to use if you like. I&#8217;ve made it very easy to change the color scheme of the icon, or to modify the graphic on its label, so you&#8217;ll have no trouble adjusting it to suit your own needs.</p>
<p><img src='http://f6design.com/journal/wp-content/uploads/2007/07/file_download_icon_row.jpg' alt='Row of file download icons' /></p>
<h3>Download</h3>
<p><a href="http://www.f6design.com/projects/filedownloadicon/file_icon.zip">Download Photoshop CS2 file</a></p>
<h3>How to use it</h3>
<p>Here is some simple CSS styling you can use to turn an ordinary link into a spiffy looking file download button.</p>
<h4>The HTML:</h4>
<pre><code>&lt;p class="fileDownload"&gt;
    &lt;a href="myfile.pdf"&gt;Download Annual Report (PDF 120Kb)&lt;/a&gt;
&lt;/p&gt;</code></pre>
<h4>The CSS:</h4>
<pre><code>.fileDownload {
    background: transparent url(file_icon.gif) no-repeat left top;
    display: block;
    height: 35px;
    padding-left: 36px;
}</code></pre>
<h4>The final result:</h4>
<style type="text/css" media="screen">
.fileDownload {
    background:transparent url(/projects/filedownloadicon/file_icon.gif) no-repeat left top;
    display: block;
    height: 35px;
    margin-top: 1em;
    padding-left: 36px;
}
</style>
<p class="fileDownload">
    <a href="#">Download Annual Report (PDF 120Kb)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/07/19/file-download-icon/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Minor update to FormBuilder</title>
		<link>http://f6design.com/journal/2007/07/06/minor-update-to-formbuilder/</link>
		<comments>http://f6design.com/journal/2007/07/06/minor-update-to-formbuilder/#comments</comments>
		<pubDate>Sat, 07 Jul 2007 06:58:15 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/07/06/minor-update-to-formbuilder/</guid>
		<description><![CDATA[I have made a minor update to my FormBuilder PHP class. It now includes support for &#8216;password&#8217; and &#8216;hidden&#8217; field types. Next up I will be adding functionality so that the submitted form variables can be emailed to any address. Stay tuned&#8230;]]></description>
			<content:encoded><![CDATA[<p>I have made a minor update to my <a href="http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/">FormBuilder</a> PHP class. It now includes support for &#8216;password&#8217; and &#8216;hidden&#8217; field types.</p>
<p>Next up I will be adding functionality so that the submitted form variables can be emailed to any address. Stay tuned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/07/06/minor-update-to-formbuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FormBuilder: HTML forms made simple</title>
		<link>http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/</link>
		<comments>http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/#comments</comments>
		<pubDate>Fri, 27 Apr 2007 13:24:06 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/</guid>
		<description><![CDATA[Even though HTML forms tend to be much of a muchness, each is different enough to require customized markup, styling, and validation. Sometimes it feels like reinventing the wheel. Over the past year I have been progressively streamlining the way I build my forms, and recently got to a point where I realized it wouldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Even though HTML forms tend to be much of a muchness, each is different enough to require customized markup, styling, and validation. Sometimes it feels like reinventing the wheel. Over the past year I have been progressively streamlining the way I build my forms, and recently got to a point where I realized it wouldn&#8217;t take much more work to create an all-in-one PHP class that generates form markup, validates input, and displays error messages to the user. So that&#8217;s what I did, and I&#8217;m sharing it here in the hope someone else finds it useful too.</p>
<h3>FormBuilder features</h3>
<p>FormBuilder is designed to do make building forms simple. It can do pretty much everything you might want to achieve with a typical HTML form:</p>
<ul>
<li>Create HTML forms by entering a few PHP values</li>
<li>Generates XHTML 1.0 Strict compliant markup</li>
<li>Fully skinnable via CSS</li>
<li>Rigorous and flexible form validation on a per-field basis</li>
<li>Displays easy to understand error messages to the user</li>
<li>Highlights required fields and fields that are in error</li>
<li>Automatically send form results to any email address</li>
<li>Displays a &#8216;thanks&#8217; message once form is successfully processed</li>
<li>Hide or show HTML content based on whether the form was successfully submitted</li>
<li>Ability to add your own custom form validation after FormBuilder has completed its own validation pass</li>
<li>Protect against PHP header injection</li>
</ul>
<h3>Demo and download</h3>
<p>I put together a demo page that shows FormBuilder in action. Try filling out the form incorrectly to see examples of FormBuilder&#8217;s error messaging.</p>
<p><a href="http://f6design.com/projects/formbuilder/" target="_blank">View FormBuilder demo</a><br />
Demonstrates default FormBuilder setup.</p>
<p><a href="http://f6design.com/projects/formbuilder/index_pretty.php" target="_blank">View FormBuilder &#8216;pretty&#8217; demo</a><br />
Demonstrates the <code>showDividers</code> and <code>usePseudoLegends</code> options. These make your forms easier to style but less semantic.</p>
<p><a href="http://f6design.com/projects/formbuilder/formbuilder_1.5.zip">Download FormBuilder</a> (current version is v1.5)</p>
<p><strong>Important:</strong> FormBuilder is a work in progress, so I can&#8217;t promise it&#8217;s completely bug free. Feedback, suggestions and bug reports are welcomed: leave a comment below.</p>
<h3>How the heck do I use this thing?</h3>
<p>You should be able to get a pretty good idea how FormBuilder works just by looking at the source code of index.php in the download package. If you want to dig a little deeper I included a text file with the package that documents all aspects of the class and how to use it. And if you&#8217;re still scratching your head feel free to post a comment below.</p>
<h3>Requirements</h3>
<p>FormBuilder must be run on a web server with PHP 4+ running (I&#8217;ve tested under both PHP4 and PHP5). A basic understanding of PHP is helpful, but if you follow the examples provided in the documentation you might be able to make do without. CSS knowledge is required if you want to change the appearance of the form.</p>
<h3>AJAX validation</h3>
<p>Over at roScripts there is a <a href="http://www.roscripts.com/Unobtrusive_Ajax_PHP_form_validation-188.html">nice tutorial</a> explaining how to modify FormBuilder so that validation is performed unobtrusively using AJAX.</p>
<h3>Changelog</h3>
<p><strong>Version 1.5</strong></p>
<ul>
<li>Better handling of checkbox results in the <code>emailResults</code> method.</li>
<li>A custom form submit URL can be passed to the FormBuilder constructor. Useful when using FormBuilder in an environment that is performing URL rewriting.</li>
<li>Replaced deprecated <code>ergei</code> functions with <code>preg_match</code>.</li>
<li>Checkbox field types are correctly processed when field is not mandatory, and the user didn&#8217;t check any of the available options.</li>
<li>Added new field type: file (for file uploads). Note that files are currently <em>not</em> emailed when using the <code>emailResults</code> method. Any handling of the uploaded files should be accomplished manually by accessing PHP&#8217;s <code>$_Files</code> array.</li>
<li>The textbox and textarea field types now accept an optional <code>defaultvalue</code> parameter.</li>
<li>Fixed a bug that meant checkboxes had a CSS class of &#8216;fbheckbox&#8217; instead of &#8216;fbcheckbox&#8217;.</li>
</ul>
<p><strong>Version 1.4</strong></p>
<ul>
<li>Added <code>emailResults</code> function, which automatically emails the form variables to any email address</li>
</ul>
<p><strong>Version 1.3</strong></p>
<ul>
<li>Added new field type: password</li>
<li>Added new field type: hidden</li>
</ul>
<p><strong>Version 1.2</strong></p>
<ul>
<li>By default there is no longer an empty <code>dd</code> after each form field, which makes FormBuilder&#8217;s markup more semantic. The empty <code>dd'</code>s provide a handy element for styling visual dividers between fields, so you can still reveal them using the new <code>showDividers</code> parameter in the FormBuilder constructor.</li>
<li>Introduced <code>usePseudoLegends</code> parameter. If set to true, <code>legend</code> will be replaced with <code>h3</code>. The HTML <code>legend</code> element is notoriously difficult to style consistently, and this parameter provides a workable alternative.</li>
<li>Cleaned up the demo CSS styles, including getting dividers displaying properly in Safari.</li>
</ul>
<p><strong>Version 1.1</strong></p>
<ul>
<li>Checkboxes and radio buttons are now correctly marked up inside label tags</li>
<li>Labels are now associated with the relevant form field via the <code>for</code> attribute</li>
</ul>
<h3>Credit where credit is due</h3>
<p>FormBuilder uses validaForms by Erick Vavretchek for form validation. Please see the <a href="http://www.phpclasses.org/browse/package/1698.html">validaForms PHP Classes package</a> if you wish to learn more about this excellent from validator.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
	</channel>
</rss>

