<?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>Jesse Hanson - Web Application Developer</title>
	<atom:link href="http://www.jessehanson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jessehanson.com</link>
	<description>web applications and ecommerce</description>
	<lastBuildDate>Sat, 07 Apr 2012 18:14:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Common Shopping Cart</title>
		<link>http://www.jessehanson.com/2012/04/07/common-shopping-cart/</link>
		<comments>http://www.jessehanson.com/2012/04/07/common-shopping-cart/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 17:37:30 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jessehanson.com/?p=414</guid>
		<description><![CDATA[I&#8217;ve been working on some e-commerce ideas since last Fall. (When it gets cold in MN, you have to find a hobby to keep you busy.) At this point, I&#8217;ve been trying to perfect what I consider to be a &#8230; <a href="http://www.jessehanson.com/2012/04/07/common-shopping-cart/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on some e-commerce ideas since last Fall. (When it gets cold in MN, you have to find a hobby to keep you busy.) At this point, I&#8217;ve been trying to perfect what I consider to be a micro shopping cart framework for PHP. I&#8217;ve done a lot of work with Magento, and some other PHP shopping cart packages, and there is always something left to desire. This is why I decided to basically &#8220;dive in&#8221; to creating my own cart components, and see what the details actually look like surrounding various shopping cart calculations.</p>
<p>I&#8217;ll let the code speak for itself. It is available on <a href="https://github.com/jesse-dev/CartComponent">github</a>: https://github.com/jesse-dev/CartComponent</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessehanson.com/2012/04/07/common-shopping-cart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony2 &#8211; first impressions</title>
		<link>http://www.jessehanson.com/2011/10/19/symfony2-first-impressions/</link>
		<comments>http://www.jessehanson.com/2011/10/19/symfony2-first-impressions/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 03:52:22 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jessehanson.com/?p=398</guid>
		<description><![CDATA[I didn&#8217;t want to spend my summer programming in my free time, so I didn&#8217;t. There were a few sunday mornings where I poked around with Symfony2 over a cup of coffee, but I wasn&#8217;t quite determined to build an &#8230; <a href="http://www.jessehanson.com/2011/10/19/symfony2-first-impressions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I didn&#8217;t want to spend my summer programming in my free time, so I didn&#8217;t. There were a few sunday mornings where I poked around with Symfony2 over a cup of coffee, but I wasn&#8217;t quite determined to build an application with it. I&#8217;ve been planning to build something with Symfony2 for some time, and now I am.</p>
<p>First off &#8211; I&#8217;m experienced with ZendFramework and ORM&#8217;s. I&#8217;ve done a lot with ZendFramework, and I&#8217;m very comfortable with it. I&#8217;m aware of some major differences between ZendFramework and Symfony2. If you do a little research, you&#8217;ll find what I&#8217;m referring to.</p>
<p>Anyways, I&#8217;ve spent the better part of the last few days with Symfony2, and here are a few things that stood out right away:</p>
<ul>
<li>clearing cache with the console tool: I ended up using `sudo rm -rf app/cache/*` because permissions are a mixture of being owned by Apache and my development username. The tool needs to create folders: prod, prod_old, prod_new, dev, dev_old, .. What is the correct way to do it??!! I don&#8217;t know.. and I wasn&#8217;t able to find any search results that provide a good example of how to deal with this. The console tool was not working as intended. In some cases I was able to clear the cache with the console tool, after running it 3 times.</li>
<li>creating model entities with relationships: for example, try creating entities &#8216;post&#8217; and &#8216;category&#8217;, where &#8216;category&#8217; is a parent to &#8216;post&#8217;. This task should be simple for someone who knows exactly what to do. Sure, practice makes perfect.. I&#8217;ve done this many times using ZendFramework and an ORM, but it took some tinkering here. What is the correct order to modify entities? I&#8217;m using yaml-based schema files rather than annotations in my Entity classes.. I ended up editing my Entity/Model files before the Symfony console would accept my schema file changes. It seems I have a little more to learn here, but the console tool did not do what I was expecting. I was expecting something similar to generating and re-generating model classes with Propel 1.6, where you basically just edit the schema, then run a command from console, and it doesn&#8217;t &#8216;complain&#8217;.</li>
<li>Generating crud from the console tool frequently errored out when creating routes. This is the last step of the multi-step dialog in the console tool, when creating crud based on an entity. Generating entities seems to recognize pre-existing functions, so I wonder why it cannot recognize pre-existing routes, and append new routes.</li>
<li>I ended up adding __toString() to my entity classes, after some research; in order for my forms to render. It&#8217;d be nice if Symfony2 left a comment or something somewhere that brought attention to the need for this.</li>
<li>It&#8217;d be nice if Symfony had an in-depth tutorial/walk-through that included some variety between parent/child relationships and integer/string keys in the database.</li>
</ul>
<p>I&#8217;m still very interested in learning about Symfony2 development, including the &#8216;gotchas&#8217;. I&#8217;m just a little surprised at this point, that some aspects are not as simple or easy-going as I&#8217;ve experienced with ZendFramework and Propel 1.6.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessehanson.com/2011/10/19/symfony2-first-impressions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How ZForms works</title>
		<link>http://www.jessehanson.com/2011/01/03/how-zforms-works/</link>
		<comments>http://www.jessehanson.com/2011/01/03/how-zforms-works/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 19:25:32 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jessehanson.com/?p=387</guid>
		<description><![CDATA[ZForms can do a lot of stuff. I&#8217;ll try and describe what&#8217;s under the hood in the simplest way I can. The general idea is to have a page or post for each step of a form, as well as &#8230; <a href="http://www.jessehanson.com/2011/01/03/how-zforms-works/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ZForms can do a lot of stuff. I&#8217;ll try and describe what&#8217;s under the hood in the simplest way I can.</p>
<p>The general idea is to have a page or post for each step of a form, as well as a confirmation page. For example, a single step form would need two posts: one for the form and one for the &#8216;thank you&#8217; page or confirmation.</p>
<p>If you edit a step within ZForms, you&#8217;ll see a dropdown box for the &#8216;Next Step&#8217;. This is where you&#8217;ll choose which post or page contains the next step of the form, even if there isn&#8217;t a form eg a confirmation page. You will want to have a unique set of posts to work with, so that the user doesn&#8217;t end up at the same post they started at. When you create a form, you&#8217;ll probably already know how many steps there will be, so I would just create the posts (if needed) right away and add the shortcode to each of them. Now, when you create your form steps, you will have the posts you&#8217;d like to use available in the dropdown box right away.</p>
<p>Once you have a form key created along with a step or two, you can create inputs. The most common inputs are available, except &#8216;File&#8217; input is not implemented yet. (It&#8217;s on the way btw.) After you&#8217;ve added at least a single input to each step of the form, you should be able to see the forms show up on your post.</p>
<p>After you&#8217;ve added inputs, you can look at adding validators. Maybe you&#8217;re expecting all numbers for an input, or maybe you&#8217;re expecting all letters for an input. This area will be growing more soon within the plugin.</p>
<p>As people submit forms, the plugin will &#8216;catch&#8217; the submission and either redirect back to the invalid form, or redirect to the next step.. </p>
<p>I&#8217;ll blog more about details. I should probably make a tutorial with screen shots. Hopefully this helps for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessehanson.com/2011/01/03/how-zforms-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZForms 1.0 is ready !</title>
		<link>http://www.jessehanson.com/2011/01/02/zforms-1-0-is-ready/</link>
		<comments>http://www.jessehanson.com/2011/01/02/zforms-1-0-is-ready/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 02:42:07 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jessehanson.com/?p=345</guid>
		<description><![CDATA[Download ZForms Be aware that this plugin requires another plugin to load Zend Framework. It also adds about 10 tables to the database. I realize this goes against the grain of using WP&#8217;s api, but I chose to use Zend &#8230; <a href="http://www.jessehanson.com/2011/01/02/zforms-1-0-is-ready/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/extend/plugins/zforms/">Download ZForms</a></p>
<p>Be aware that this plugin requires another plugin to load Zend Framework. It also adds about 10 tables to the database. I realize this goes against the grain of using WP&#8217;s api, but I chose to use Zend Framework&#8217;s api instead, and part of it requires having tables with primary keys. I think this will help shed some light on how ZF and WP can work together.</p>
<p>This should be a valuable tool for anyone who is interested in learning about Zend Framework and WordPress plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jessehanson.com/2011/01/02/zforms-1-0-is-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC-based WordPress plugins</title>
		<link>http://www.jessehanson.com/2011/01/02/mvc-based-wordpress-plugins/</link>
		<comments>http://www.jessehanson.com/2011/01/02/mvc-based-wordpress-plugins/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 19:48:55 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jessehanson.com/?p=224</guid>
		<description><![CDATA[A majority of WP plugins store all of the functionality in two or three files. While this works fine for simple options and posts, it is possible to structure the plugin in a way that resembles the Model-View-Controller design pattern. &#8230; <a href="http://www.jessehanson.com/2011/01/02/mvc-based-wordpress-plugins/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div style="float:left;">
<div>
<p>A majority of WP plugins store all of the functionality in two or three files. While this works fine for simple options and posts, it is possible to structure the plugin in a way that resembles the Model-View-Controller design pattern. When using MVC with larger plugins, the amount of code that is loaded will be much less compared to having everything in two or three files. The weight of the plugin will change less as functionality is added to the plugin. This is another reason to structure your WP plugin code in an MVC fashion. </p>
<p>Most WP users have heard of &#8216;Hello Dolly&#8217;, the single file plugin that we all look at when we decide we&#8217;re going to learn about WP plugins. The first thing we learn is that we can do a lot with a single file. The next thing we learn is that WP is procedural and uses a defined set of events that can be hooked into from anywhere within WP&#8217;s load process. From an MVC perspective, this is where the styles need to be adapted to each other. A good solution is to designate a script to serve as the plugin controller. With MVC, we&#8217;re going to separate our objects into modules and actions, which should keep the plugin lightweight regardless of how large our plugin application becomes. Although, at a certain level, this may be overkill for some smaller plugins.</p>
</div>
<div style="width: 100%;">
<div style="float:left;">
<p>Ok, so let&#8217;s use an example to illustrate this concept. Let&#8217;s say you want to store food information. We want to be able to separate the vegetables from the fruit, so we need food categories as well as food items. We will need to be able to add and edit everything as needed, so we&#8217;re looking at implementing CRUD (create/retrieve/update/delete). This means we&#8217;re looking at separating our two modules (categories and items) into actions, similar to MVC controller actions. Many apps use: add, edit, update, trash, and list as the action names, so that&#8217;s what we&#8217;ll use for this example. From here, we know what most of our file structure will look like.</p>
<p>As far as the plugin settings, you could do that like most plugins do, and basically have a single file for handling it all. This isn&#8217;t illustrated in the image.</p>
</p></div>
<div style="float:right;padding:5px;">
<p>
   <a href="http://www.jessehanson.com/wp-content/uploads/2011/01/mvc-files.png"><img class="alignnone size-full wp-image-225" title="mvc-files" src="http://www.jessehanson.com/wp-content/uploads/2011/01/mvc-files.png" alt="" width="198" height="481" /></a>
  </p>
</p></div>
</div>
<div style="width:100%">
<p>We want my-plugin.php to load my-controller.php as the main script. What goes into my-controller.php ? </p>
<div>
<pre><code>$module = $_GET['my_module'];
$action = $_GET['my_action']; //careful with WP's url vars
$defaultModule = 'categories';
$defaultAction = 'list';
$moduleActions = array(
    'categories' =&gt; array('add','edit','update','trash','list'),
    'items' =&gt; array('add','edit','update','trash','list'),
);
if (!isset($moduleActions[$module])) {
    $module = $defaultModule;
}
$actions = $moduleActions[$module];
if (!in_array($action, $actions)) {
    $action = $defaultAction;
}
include "modules/{$module}/{$action}.inc.php";
  </code></pre>
</p></div>
<div style="padding-top:15px;">
<p>This is the simplest way to illustrate what it would look like. Basically, you&#8217;re getting two strings from the url and including a single file. The goal is to load code for a single action by referencing the module and its action. Also, by pre-defining the action files that exist in your plugin with an array, you can control access to the plugin files. If someone is messing with the url string, they will get the default module and action. You would probably want to filter request parameters also. Any changes you make here will affect most of the plugin functionality, as this is the main code that the my-plugin.php file includes in WordPress admin.</p>
<p>What goes into an edit.inc.php file?</p>
<div>
<pre><code>if (!empty($_POST)) {
    $formData = $_POST; //should sanitize
    //save submission to database
    include("list.inc.php"); //cannot redirect to listing
} else if (!empty($_GET['row_id'])) {
    $rowId = $_GET['row_id'];
    //load row data into form, and display form
    include("helper/form.inc.php");
    $form = helper::getForm($rowId, $populate);
    echo $form;
} else {
    //we didn't get the row Id, so show the listing again
    include("list.inc.php");
}
   </code></pre>
</p></div>
</p></div>
<div>
<p>There are some blanks to fill in this code example, but it should look similar to most form handlers. Basically, you&#8217;re either displaying the form or handling the form being submitted. You can leave the form action blank for this, so it submits to itself. You could add an extra step in the form handler to validate the form and re-display it with the validation errors if the submission doesn&#8217;t validate. Also, I recommend using a common getter method for retrieving and populating the form like the helper/form.inc.php file in the image and the helper::getForm() method in the code example.</p>
<p>Hopefully this provides a simple example of how WordPress plugins can resemble MVC. If you&#8217;d like to explore this concept further, you could <a href="http://wordpress.org/extend/plugins/zforms/">download my plugin</a>, ZForms, and look at the code. I include Zend Framework code in the plugin, so it can serve as an introduction to Zend Framework also.</p>
</p></div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.jessehanson.com/2011/01/02/mvc-based-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZForms Plugin</title>
		<link>http://www.jessehanson.com/2010/11/12/zforms-plugin/</link>
		<comments>http://www.jessehanson.com/2010/11/12/zforms-plugin/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 04:13:58 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jessehanson.com/?p=130</guid>
		<description><![CDATA[I started coding a WP plugin a few weeks ago. I&#8217;m naming it ZForms, short for Zend Forms. I really like the form interface in Zend Framework. Besides having elegant and modular functions for creating and validating forms, it is &#8230; <a href="http://www.jessehanson.com/2010/11/12/zforms-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I started coding a WP plugin a few weeks ago. I&#8217;m naming it ZForms, short for Zend Forms. I really like the form interface in Zend Framework. Besides having elegant and modular functions for creating and validating forms, it is friendly to creating forms programmatically.. This is the idea behind the ZForms plugin.</p>
<p>As a web application developer, I&#8217;ve worked with a list of content management systems and web application frameworks. This plugin brings together some ideas and concepts that I&#8217;ve chosen as being powerful and effective. I&#8217;m hoping ZForms will bring useful and valuable tools to WordPress.</p>
<div><a href="/zforms-screenshot.png">Screenshot1</a> | <a href="/zforms-shortcode.png">Screenshot2</a> | <a href="http://www.jessehanson.com/about-zforms/" alt="About ZForms">About ZForms</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jessehanson.com/2010/11/12/zforms-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

