<?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>Fuel Your Coding &#187; Frameworks</title>
	<atom:link href="http://fuelyourcoding.com/category/devtools/frameworks-devtools/feed/" rel="self" type="application/rss+xml" />
	<link>http://fuelyourcoding.com</link>
	<description></description>
	<lastBuildDate>Tue, 03 Jan 2012 11:01:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Meet Storytlr</title>
		<link>http://fuelyourcoding.com/meet-storytlr/</link>
		<comments>http://fuelyourcoding.com/meet-storytlr/#comments</comments>
		<pubDate>Mon, 10 May 2010 14:08:17 +0000</pubDate>
		<dc:creator>John Hobbs</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://fuelyourcoding.com/?p=932</guid>
		<description><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
]]></description>
			<content:encoded><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
<h2>What is Storytlr?</h2>
<p><a href="http://en.wikipedia.org/wiki/Lifestreaming">Lifestreaming</a> is the aggregation of all of your actions throughout the web in one place to present a complete picture of your digital life. There are several lifestreaming applications out there, and <a href="http://storytlr.org/">Storytlr</a> was one of the first.</p>
<p>Storytlr was originally a closed source, hosted web application started by Laurent Eschenauer and Alard Weisscher in 2008. In October 2009 they decided to close the service and in December they open sourced the code.</p>
<p>Considerable community development has occurred since the project was open sourced, including many new plugins, bug fixes and features.</p>
<h2>Installing Storytlr</h2>
<p>Storytlr is written in PHP and based around the <a href="http://framework.zend.com/">Zend</a> framework. It is usually run on Apache, but works fine on lighttpd and Nginx. The current stable release is 0.9.2, although there is an RC 0.9.3 that works well.  Additionally you can use the bleeding edge code on <a href="http://github.com/storytlr/core">GitHub</a>.  I currently maintain my own version of 0.9.3 that has a few more features and plugins you won&#8217;t find in the core. You can find it <a href="http://github.com/jmhobbs/storytlr">here</a>.</p>
<p>Since it&#8217;s coming out of a close source system, expect some rough edges and thin documentation.  This is improving all the time with the growing <a href="http://code.google.com/p/storytlr/wiki/WikiHome?tm=6">wiki</a> and the <a href="http://code.google.com/p/storytlr/issues/list">issues board</a>.  Installation is still one of those rough edges, but it&#8217;s fairly easy anyway.</p>
<p>For simplicity I&#8217;ll be using the 0.9.2 release from the <a href="http://code.google.com/p/storytlr/downloads/list">Google Code site</a>, but these instructions can be easily adapted to other versions.  I&#8217;ll be doing just about everything from the command line, so if you don&#8217;t have shell access, be prepared to tweak things a bit.</p>
<h3>Requirements</h3>
<p>First, let&#8217;s make sure our server is compatible.  0.9.2 has the following requirements:</p>
<ul>
<li>PHP 5</li>
<li>mcrypt</li>
<li>PDO</li>
<li>Tidy</li>
<li>MySQL</li>
<li>Zend Framework</li>
</ul>
<p>An easy way to check compatibility is to use <a href="http://gist.github.com/raw/393739/storytlr_requirements_check.php">this script</a>.</p>
<p>Most hosts have these extensions. The rarest one is Tidy.  For instance, Dreamhost does not run Tidy.  If your host doesn&#8217;t have Tidy, you can work around it by using a different version with the <a href="http://code.google.com/p/storytlr/issues/detail?id=64&amp;can=1&amp;q=htmLawed#c1">htmLawed patch</a>.</p>
<p>If you are missing Zend, that can be downloaded <a href="http://framework.zend.com/download/current/">here</a>. Make sure to put it in your PHP include path.</p>
<h3>Getting Started</h3>
<p>Now that you&#8217;ve got the requirements met, download the <a href="http://code.google.com/p/storytlr/downloads/list">0.9.2 file</a> and unpack it into your root web directory.</p>
<pre class="brush: bash;">
jmhobbs@katya:/var/www/lifestream$ wget http://storytlr.googlecode.com/files/storytlr-0.9.2.tgz
--2010-05-07 13:33:05--  http://storytlr.googlecode.com/files/storytlr-0.9.2.tgz
Resolving storytlr.googlecode.com... 74.125.45.82
Connecting to storytlr.googlecode.com|74.125.45.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8748114 (8.3M) [application/x-gzip]
Saving to: “storytlr-0.9.2.tgz”

100%[============================================&gt;] 8,748,114    233K/s   in 36s

2010-05-07 13:33:41 (239 KB/s) - “storytlr-0.9.2.tgz” saved [8748114/8748114]

jmhobbs@katya:/var/www/lifestream$ tar -zxf storytlr-0.9.2.tgz
jmhobbs@katya:/var/www/lifestream$ ls -a
.  ..  feeds  flash  friendconnect  .htaccess  images  index.php  INSTALL  js  LICENSE  protected  storytlr-0.9.2.tgz  style  themes
jmhobbs@katya:/var/www/lifestream$
</pre>
<h3>The Database</h3>
<p>Now you need to load the database schema. The schema files is located at <tt>protected/install/database.sql</tt>.  If you don&#8217;t have a database or user set up, now is the time to do that as well.</p>
<pre class="brush: bash;">
jmhobbs@katya:/var/www/lifestream$ cd protected/install/
jmhobbs@katya:/var/www/lifestream/protected/install$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5515
Server version: 5.0.81-1 (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; create database lifestream;
Query OK, 1 row affected (0.05 sec)

mysql&gt; grant all on lifestream.* to lifestream@localhost identified by 'supersecretpassword';
Query OK, 0 rows affected (0.11 sec)

mysql&gt; flush privileges;
Query OK, 0 rows affected (0.08 sec)

mysql&gt; use lifestream;
Database changed
mysql&gt; source database.sql
Query OK, 0 rows affected (0.00 sec)

(Lines Removed For Brevity)

Query OK, 0 rows affected (0.00 sec)

mysql&gt; Bye
jmhobbs@katya:/var/www/lifestream/protected/install$
</pre>
<h3>Configuration</h3>
<p>Your last major step is the configuration file, which goes at <tt>protected/config/config.ini</tt>.  Storytlr provides an example file with good defaults, so we&#8217;ll edit that.  The key settings to change are:</p>
<ul>
<li>db.username</li>
<li>db.password</li>
<li>db.dbname</li>
<li>security.cookie</li>
<li>web.host</li>
<li>web.timezone</li>
</ul>
<pre class="brush: bash;">
jmhobbs@katya:/var/www/lifestream$ cd protected/config/
jmhobbs@katya:/var/www/lifestream/protected/config$ ls
config.ini.sample
jmhobbs@katya:/var/www/lifestream/protected/config$ cp config.ini.sample config.ini
jmhobbs@katya:/var/www/lifestream/protected/config$ vim config.ini

[general]

;Database connection settings
db.adapter=PDO_MYSQL
db.host=localhost
db.username=lifestream
db.password=supersecretpassword
db.dbname=lifestream

;Security
security.cookie = kg89y6gbval

;Caching
;cache.content = 1
;cache.metadata = 1
;cache.path = /tmp/cache/

;Web deployment settings
web.host=lifestream.velvetcache.org
web.path=/
web.redirect = 1
web.timezone=America/Chicago
jmhobbs@katya:/var/www/lifestream/protected/config$
</pre>
<h3>The Fruits of Our Labor</h3>
<p>At this point your lifestream should be working, open a browser and take a look.</p>
<p><img class="alignnone size-medium wp-image-934" title="It Works!" src="http://fuelyourcoding.com/files/storytlr-1-600x429.png" alt="It Works!" width="600" height="429" /></p>
<p>Now we need to change our password, so go to the admin page <tt>http://www.example.com/admin</tt> and log in. The default username and password are <tt>admin</tt> and <tt>storytlr</tt> respectively.  You can find that under <strong>Configure » Password</strong>.</p>
<p><img class="alignnone size-medium wp-image-936" title="Change Password" src="http://fuelyourcoding.com/files/storytlr-3-600x429.png" alt="Change Password" width="600" height="429" /></p>
<p>There are lots of options to browse through, and I won&#8217;t cover them all, but I&#8217;d like to run through setting up a source. Sources are the core of lifestreaming, and there are lots of options to choose from. In the admin interface go to <strong>Sources</strong> and click <strong>Add</strong> next to a source you want to add, I&#8217;ll use Delicious in my example.</p>
<p>This should present you with a form asking for some information. Each source is going to be slightly different, but all should be pretty easy to understand. Fill that out and it should import what it can from that source.</p>
<p><img class="alignnone size-medium wp-image-938" title="Delicious" src="http://fuelyourcoding.com/files/storytlr-5b-600x429.png" alt="Delicious" width="600" height="429" /></p>
<p><img class="alignnone size-medium wp-image-939" title="Importing" src="http://fuelyourcoding.com/files/storytlr-6b-600x429.png" alt="Importing" width="600" height="429" /></p>
<p>There you have it! Add some more sources until your lifestream really fleshes out.</p>
<p><img class="alignnone size-medium wp-image-940" title="Lifestream!" src="http://fuelyourcoding.com/files/storytlr-8b-600x429.png" alt="Lifestream!" width="600" height="429" /></p>
<h3>Keeping Current</h3>
<p>The very last step, which is often overlooked, is updating your sources. The primary means for this is the PHP script <tt>protected/tools/update.php</tt>. This must be run from the command line with the name of the user to update.  Here&#8217;s an example:</p>
<pre class="brush: bash;">
jmhobbs@katya:/var/www/lifestream$ php5 protected/tools/update.php admin
Memory usage on startup: 4997940
Memory: 5351904
Memory: 5351904
Updating source delicious for user admin [0/2] (5).... found 0 items
Updated 1 out of 2 sources in 1 seconds.
jmhobbs@katya:/var/www/lifestream$
</pre>
<p>It&#8217;s common to set up a cron job to handle these updates. It&#8217;s often important to put in full paths for your cron jobs.  This example will update my sources every 10 minutes. You can learn more about cron <a href="http://www.linuxhelp.net/guides/cron/">here</a>.</p>
<pre class="brush: bash;">
jmhobbs@katya:/var/www/lifestream$ crontab -e
MAILTO=jmhobbs@towncommons.com
# m h  dom mon dow   command
*/10 * * * * /usr/bin/php5 /var/www/lifestream/protected/tools/update.php admin
jmhobbs@katya:/var/www/lifestream$
</pre>
<p>Storytlr has lots more features and configuration options, I would encourage you to browse around and make your installation suit your taste. To see an example of a fully customized Storytlr installation, you can visit mine at <a href="http://lifestream.velvetcache.org/">http://lifestream.velvetcache.org/</a></p>
<h2>Going Further</h2>
<p>Storytlr is rich with opportunities to contribute. It&#8217;s fairly young and has lots of finicky little things to figure out, and it can always use one more plugin.  Lots of stuff is in the works, including a much simpler installer which will make most of this article obsolete!</p>
<p>Documentation is in need of some TLC, and more eyes on the bug reports would be great.</p>
<p>To get involved visit the <a href="http://code.google.com/p/storytlr">Storytlr Google Code</a> site or hop onto Github and <a href="http://github.com/storytlr/core">fork the project</a>.  Finally, you can also join us on Freenode IRC in <a href="irc://chat.freenode.net/storytlr">#storytlr</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fuelyourcoding.com/meet-storytlr/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Roll Your Own PHP Framework: Part III</title>
		<link>http://fuelyourcoding.com/roll-your-own-php-framework-part-iii/</link>
		<comments>http://fuelyourcoding.com/roll-your-own-php-framework-part-iii/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 16:10:33 +0000</pubDate>
		<dc:creator>Wess Cope</dc:creator>
				<category><![CDATA[Concepts & Training]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://fuelyourcoding.com/?p=652</guid>
		<description><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Strict//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&#34;&#62;
&#60;html&#62;
	&#60;head&#62;
		&#60;meta http-equiv=&#34;Content-type&#34; content=&#34;text/html; charset=utf-8&#34;&#62;
		&#60;title&#62;My PEANUT Page&#60;/title&#62;

	&#60;/head&#62;
	&#60;body&#62;
		&#60;h1&#62;&#60;?php echo $title ?&#62;&#60;/h1&#62;
		&#60;p&#62;&#60;?php echo $message ?&#62;&#60;/p&#62;

		&#60;h2&#62;Users:&#60;/h2&#62;
		&#60;table&#62;
			&#60;thead&#62;
				&#60;tr&#62;
					&#60;th&#62;ID&#60;/th&#62;
					&#60;th&#62;Username&#60;/th&#62;
					&#60;th&#62;Password&#60;/th&#62;
				&#60;/tr&#62;
			&#60;/thead&#62;
			&#60;tbody&#62;
				&#60;!--
					Here we are going to use native php foreach look
					to create each row of the table with our list of users.
					Notice how the foreach is done with a : and surrounding php tags.
				--&#62;
				&#60;?php foreach($users as $user): ?&#62;
					&#60;tr&#62;
						&#60;td&#62;&#60;?php [...]]]></description>
			<content:encoded><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
<p>In <a href="http://fuelyourcoding.com/php-frameworks-just-roll-your-own-part-1/">Part I</a> and <a href="http://fuelyourcoding.com/roll-your-own-php-framework-part-ii/">Part II</a> we looked at how to set up our file structure, how to get URL routing working and how to set up templating for our little framework. In this final part to the series, we are going to briefly look at database access.</p>
<p><strong>Mini-series Overview</strong></p>
<ul>
<li><a href="http://fuelyourcoding.com/php-frameworks-just-roll-your-own-part-1/">Part 1: URL Routing and Directory Setup</a></li>
<li><a href="http://fuelyourcoding.com/roll-your-own-php-framework-part-ii/">Part 2: Templating</a></li>
<li>Part 3: Database Interaction</li>
</ul>
<p>You can download all the files put together during this three part series here:</p>
<div class="post_buttons" style="margin-bottom: 20px"><a href="http://fuelyourcoding.com/files/peanut_framework.zip"><img class="size-full wp-image-24 alignnone" style="margin-left: 30px" src="http://fuelyourcoding.com/files/download-button.gif" alt="Download zipped archive" width="229" height="68" /></a></div>
<p>I&#8217;m not going into detail about how to create an ORM or ActiveRecord clone.  We are just going to write a simple helper class to setup our connection and query.  Also I&#8217;m going to assume you know how to create a database and table in the database.</p>
<p>I have created a database called &#8220;peanut&#8221; and created table:</p>
<pre class="brush: plain;">
users:
+----------+--------------+------+-----+---------+----------------+
| Field    | Type         | Null | Key | Default | Extra          |
+----------+--------------+------+-----+---------+----------------+
| id       | int(11)      | NO   | PRI | NULL    | auto_increment |
| username | varchar(255) | NO   |     | NULL    |                |
| password | varchar(255) | NO   |     | NULL    |                |
+----------+--------------+------+-----+---------+----------------+
</pre>
<p>In this example we are going to use Mysql and the php mysql_ methods.  So break open system/database.php and drop the following in:</p>
<pre class="brush: php;">
&lt;?php

// Here is where we are setting up a simple wrapper class around mysql
// functions just to make it a little more convenient.  Our models will
// simple extend our database class and simplify making queries just a bit.
class Database
{
	protected var $connection;
	// Every time you instantiate this class you are going to create
	// a new connection to the database.
	public function __construct()
	{
		// First we setup up a nice little connection to the database,
		// make sure you use your connection information.  If the
		// connection fails we just die with the error.
		$this-&gt;connection = mysql_pconnect(&quot;localhost&quot;, &quot;root&quot;, &quot;somepassword&quot;) or die(&quot;MySQL Error: &quot; . mysql_error());

		// And let's tell mysql which db we are going to use.
		mysql_select_db( &quot;peanut&quot;, $this-&gt;connection );
	}

	// This is just a helper function to help out against
	// possible sql injection attacks.
	public function escapeString($string)
	{
		// we call mysql's 'cleaning' function on strings
		// just to make sure we get a little safer item to query
		// with.
		return mysql_real_escape_string($string);
	}

	// Here we will query the database with the passed query string,
	// build up an array of objects and return them, simple enough.
	public function query($qry)
	{
		// Here we make our query and set the result to a $result variable
		$result = mysql_query($qry) or die(&quot;MySQL Error: &quot; . mysql_error());

		// Create a container array variable to hold all of our result objects.
		$resultObjects = array();

		// This might look weird, but all we are doing is saying,
		// While you are still getting results, please put the next
		// result into the next spot on my array.
		while($resultObjects[] = mysql_fetch_object($result));

		// Now we just return our array that has all our result objects in it
		return $resultObjects;
	}

	// Here we add a simplier method for handling INSERTs and UPDATEs since
	// they do not return a result set.
	public function execute($qry)
	{
		$exec = mysql_query($qry) or die(&quot;MySQL Error: &quot; . mysql_error());
		return $exec;
	}
}
?&gt;
</pre>
<p>So we have our database class in place and ready to use, now we just need to require it in the index.php like we did the others, so pop that bad boy open and after the template require, do one just like it but for the database.php</p>
<p>Now let&#8217;s crack open actions/helloworld/models.php and let&#8217;s write a simple addUser and getAllUsers method to it.  We are going to make our model a class as well so that it  can extend our Database class that we wrote.</p>
<p>Here are the guts:</p>
<pre class="brush: php;">
&lt;?php

// All of our database back-and-forth will be handled in our models file
// Don't be mistaken, this is no where close to an ORM (Object Relational Mapper)
// it's just simplified database access.

class myModel extends Database
{
	// When our model is instantiated we just need
	// to also instantiate our parent class (Database)
	// so it knows to make the connection to the database.
	public function __construct()
	{
		// We just call the __construct of Database class.
		parent::__construct();
	}

	// addUser will use the execute method of Database
	// since we are inserting a value and not expecting
	// anything in return.
	public function addUser($username, $password)
	{
		// Here we use that little cleaning method we
		// wrote to make our strings pretty and make sure
		// they will play nice with mysql
		$username = $this-&gt;escapeString($username);
		$password = $this-&gt;escapeString($password);

		// We execute our insert and if it worked $success
		// will be true else it will be false.
		$success = $this-&gt;execute(&quot;INSERT INTO users (username, password) VALUES ('{$username}','{$password}')&quot;);

		// We return $success to inform our page action that it has or hasn't worked.
		return $success;
	}

	// This method does just what you think it would.
	// We are going to use the query function because
	// we are expecting data back, then we are just
	// going to return the array of user objects.
	public function getAllUsers()
	{
		// Populate the $users variable with the results of our query
		$users = $this-&gt;query(&quot;SELECT * FROM users&quot;);

		// Now we return our results
		return $users;
	}
}
?&gt;
</pre>
<p>Now we need to change our actions/helloworld/actions.php mypage page action to:</p>
<pre class="brush: php;">
&lt;?php
// We need to include our models file so we can access the database
require(PEANUT_ROOT_DIR . 'actions/helloworld/models.php');

// We simply define the function (the second item in our request url)
// making sure it is the same name as the one in the url.

function mypage()
{
	// Let's do some database work!
	// Here we are going to instantiate our model
	$model = new myModel();

	// Now let's add a user
	// On a funny note, if you keep refreshing it will add this
	// user over and over in your users table so your getAllUsers call
	// will result in a list that grows by one each time.
	$model-&gt;addUser(&quot;wess&quot;, &quot;password&quot;);

	// Now let's fetch all of our users and put them in our users
	// variable.
	$users = $model-&gt;getAllUsers();

	// Let's create a new template object and pass it the path to our template
	$template = new Template(&quot;helloworld/templates/helloworld.php&quot;);

	// I bet you want to display a table in your template with all your newly
	// created users. So let's do it

	// That's write we use the same set command, and it will set our array of users
	// to our template variable $users, and since php is our template language
	// it's real easy to print them to the screen.
	$template-&gt;set('users', $users);

	// Set our page variable &quot;title&quot; with the value &quot;Hello World&quot;
	$template-&gt;set('title', 'Hello World');

	// Set our page variable &quot;message&quot; with our little message
	$template-&gt;set('message','This is my first message for my template');

	// Now we can call render and return it to dispatch to
	// display in our browser
	return $template-&gt;render();
}
?&gt;
</pre>
<p>So now you are handing all your users from your database to the template, so let&#8217;s display them. Change your <tt>actions/helloworld/templates/helloworld.php</tt> file to:</p>
<pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;meta http-equiv=&quot;Content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
		&lt;title&gt;My PEANUT Page&lt;/title&gt;

	&lt;/head&gt;
	&lt;body&gt;
		&lt;h1&gt;&lt;?php echo $title ?&gt;&lt;/h1&gt;
		&lt;p&gt;&lt;?php echo $message ?&gt;&lt;/p&gt;

		&lt;h2&gt;Users:&lt;/h2&gt;
		&lt;table&gt;
			&lt;thead&gt;
				&lt;tr&gt;
					&lt;th&gt;ID&lt;/th&gt;
					&lt;th&gt;Username&lt;/th&gt;
					&lt;th&gt;Password&lt;/th&gt;
				&lt;/tr&gt;
			&lt;/thead&gt;
			&lt;tbody&gt;
				&lt;!--
					Here we are going to use native php foreach look
					to create each row of the table with our list of users.
					Notice how the foreach is done with a : and surrounding php tags.
				--&gt;
				&lt;?php foreach($users as $user): ?&gt;
					&lt;tr&gt;
						&lt;td&gt;&lt;?php echo $user-&gt;id ?&gt;&lt;/td&gt;
						&lt;td&gt;&lt;?php echo $user-&gt;username ?&gt;&lt;/td&gt;
						&lt;td&gt;&lt;?php echo $user-&gt;password ?&gt;&lt;/td&gt;
					&lt;/tr&gt;
				&lt;?php endforeach; ?&gt;
			&lt;/tbody&gt;
		&lt;/table&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Now if all went well, you should save all your files and open up: <a href="http://mywebapp.local/helloworld/mypage">http://mywebapp.local/helloworld/mypage</a> and see all the users that you added in a table.</p>
<p>So you have created a template class, url basic url routing, simplified database access, and a page action.  You have all the core basics of a PHP Framework at your hands now.  This is just for a starting point or foundation of understanding, please do not use this in a production environment.</p>
<p>I have really enjoyed writing this and I hope you learned something from my rambling!  The source code is available for download at the top of this article.</p>
<p>Take care,<br />
Wess &#8220;Wattz&#8221;</p>
<p><strong>Updated October 26, 2009: Thanks to Alex and Ian for spotting some errors in the code and supplying the fixes. The code examples have been updated to reflect the changes as has the ZIP file.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://fuelyourcoding.com/roll-your-own-php-framework-part-iii/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Roll Your Own PHP Framework: Part II</title>
		<link>http://fuelyourcoding.com/roll-your-own-php-framework-part-ii/</link>
		<comments>http://fuelyourcoding.com/roll-your-own-php-framework-part-ii/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 13:03:35 +0000</pubDate>
		<dc:creator>Wess Cope</dc:creator>
				<category><![CDATA[Concepts & Training]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://fuelyourcoding.com/?p=623</guid>
		<description><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
]]></description>
			<content:encoded><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
<p><a href="http://fuelyourcoding.com/php-frameworks-just-roll-your-own-part-1/">A little over a week ago</a>, we looked at how to set up our file structure and how to get URL routing working in our little framework. So we now have something to handle urls and display a page, but we want to make the page a little more attractive. Since there is nothing fun about making php print html, let&#8217;s add a template piece to the puzzle. We won&#8217;t have to do too much since php is a great template language by itself. </p>
<p><strong>Mini-series Overview</strong></p>
<ul>
<li><a href="http://fuelyourcoding.com/php-frameworks-just-roll-your-own-part-1/">Part 1: URL Routing and Directory Setup</a></li>
<li>Part 2: Templating</li>
<li>Part 3: Database Interaction</li>
</ul>
<p><em>Note: I&#8217;m assuming you have a little OOP (Object Oriented Programming) experience.  There are a ton of tutorials out there, so just a heads up:  I won&#8217;t be teaching/explaining OOP here.</em></p>
<p>We are going to create a class <tt>Template</tt> and add a little code to it so it will return our pretty new page to our browser.</p>
<p>Wipe out <tt>system/template.php</tt> and add the following code to it:</p>
<pre class="brush: php;">
&lt;?php
// We are creating a simple class here to handle our templating.
// All this class will do is set some variables and return
// a rendered webpage using native php as the template language.
class Template
{
	// We setup $pageVars to hold all our pages
	// variables.
	private $pageVars = array();

	// We setup $template to define what file is our
	// template and were to get it.
	private $template;

	// When a new Template object is instantiated we want to make sure
	// we pass it a shortened path to the file we want it to use
	// as our template.
	// example: $template = new Template(&quot;helloworld/templates/helloworld.php&quot;);

	public function __construct($template)
	{

		// We setup our action directory
		$actionsDirectory = PEANUT_ROOT_DIR . 'actions';

		// Let's build and set our class var $template to the
		// value of $template that was passed into our __construct method
		$this-&gt;template = $actionsDirectory . '/' . $template;
	}

	// Now we create out set method to allow use to set variables that
	// we want in the template.
	// So in our page action we would do:
	// $template-&gt;set(&quot;title&quot;, &quot;hello world&quot;);
	// and in our template:
	// &lt;h1&gt;&lt;?php echo $title; ?&gt;&lt;/h1&gt;
	public function set($var, $val)
	{
		// This may look weird, but it's not to bad;
		// what we are doing is setting the index name
		// of our associative array pageVars
		// (we setup earlier at the top of the class)
		// to the value that we pass. so $pageVars[&quot;yourVar&quot;] = &quot;yourValue&quot;
		// is basically what it's doing.
		$this-&gt;pageVars[$var] = $val;
	}

	// To render we will need to do a couple of things.
	// First we will need to extract those pageVars then
	// include the template, populate the values in the template
	// and return a rendered page to the browser
	//
	// This is far more easy than you think it is
	// trust me!
	public function render()
	{
		// The extract function is a weird bird
		// when you call it on an associative array
		// it creates regular vars.
		// For instance:
		// 		$this-&gt;pageVars[&quot;yourVar&quot;]
		// becomes:
		// 		$yourVar
		// so basically we are converting all the
		// index keys (with their values), in pageVars to
		// their own respected variables
		extract($this-&gt;pageVars);

		// Now that we have all the variables extracted, the vars we set
		// in the template will be replaced by the value of the pageVars variables.
		// Now we start up our output buffer, grab our template and return the
		// buffer with it's &quot;rendered&quot; template
		ob_start();
			require($this-&gt;template);
		return ob_get_clean();
	}
}
</pre>
<p>Well hello templating! Now let&#8217;s do a couple of things to hook it up to our framework. First, let&#8217;s open up our <tt>www/index.php</tt> one more time and add the following line:</p>
<p>	require(PEANUT_ROOT_DIR . &#8217;system/template.php&#8217;);</p>
<p>Right underneath the <tt>dispatch.php</tt> require statement. Now let&#8217;s change our <tt>actions/helloworld/actions.php</tt> <tt>mypage</tt> function to look like:</p>
<pre class="brush: php;">
// We simply define the function (the second item in our request url)
// making sure it is the same name as the one in the url.
function mypage()
{
	// Let's create a new template object and pass it the path to our template
	$template = new Template(&quot;helloworld/templates/helloworld.php&quot;);

	// Set our page variable &quot;title&quot; with the value &quot;Hello World&quot;
	$template-&gt;set('title', 'Hello World');

	// Set our page variable &quot;message&quot; with our little message
	$template-&gt;set('message','This is my first message for my template');

	// Now we can call render and return it to dispatch to
	// display in our browser
	return $template-&gt;render();
}
</pre>
<p>Ok, so now our page action is setup to use our new found template class, now we need to setup our template</p>
<p>So inside actions/helloworld/templates/helloworld.php template put the following:</p>
<pre class="brush: xml;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;meta http-equiv=&quot;Content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
		&lt;title&gt;My PEANUT Page&lt;/title&gt;

	&lt;/head&gt;
	&lt;body&gt;
		&lt;!--
		See how we use native php here?
		echo out a variable, this is the same
		variable name that you use in your template
		set method ($template-&gt;('title', &quot;hello&quot;)).
		--&gt;
		&lt;h1&gt;&lt;?php echo $title ?&gt;&lt;/h1&gt;
		&lt;p&gt;&lt;?php echo $message ?&gt;&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Ok, so let&#8217;s see where we are at.  We have basic url routing, templating, and page actions.  We are only missing one thing, a way to talk to the database! That will be the next and final article in our mini-series on rolling your own PHP Framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://fuelyourcoding.com/roll-your-own-php-framework-part-ii/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Getting Started Writing WordPress Plugins</title>
		<link>http://fuelyourcoding.com/getting-started-writing-wordpress-plugins/</link>
		<comments>http://fuelyourcoding.com/getting-started-writing-wordpress-plugins/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 17:41:29 +0000</pubDate>
		<dc:creator>Douglas Neiner</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins / Add-Ons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://fuelyourcoding.com/?p=189</guid>
		<description><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
]]></description>
			<content:encoded><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
<h2>Why WordPress?</h2>
<p>For those who use WordPress on a daily basis, this is a no-brainer. However, as everyone seems to have their own pet CMS, it is sometimes hard for them to understand why anyone would use WordPress for something other than just a blogging platform. I am sure there are many pros and cons, but I will just give my personal answer: I feel very comfortable using and pushing the limits of WordPress for projects because of the huge install and developer base, the active development work being done, the amount of documentation available to my client, and the extensibility and integration my code has with the WordPress core.</p>
<h2>Why WordPress Plugins?</h2>
<p>A WordPress plugin can be a single PHP file or a complex collection of PHP, CSS, JS and images all used together to add new or enhanced functionality to the WordPress core.</p>
<p>Since almost everything you can put in a plugin you can also just dump into a functions.php file in your theme directory, why should you bother building a plugin? Here are a few reasons I find important:</p>
<ul>
<li>Plugins are focused pieces of code structured to accomplish one task. The very nature of a plugin makes it easy to maintain.</li>
<li>Because of the modular nature of a plugin, it makes your code instantly reusable on other projects (Depending on your code ownership agreements with your clients, of course.)</li>
<li>If over time it grows into a truly helpful collection of code, having it in a plugin allows you to release it to the public quickly and easily.</li>
<li>Having large chunks of functionality split into plugins makes changes to the PHP and related files easier to make later.</li>
</ul>
<p>I think WordPress plugins should be especially important to anyone running a web application that could benefit from direct integration into the WordPress platform. This could include a WordPress sidebar widget that pulls information from your website, a shortcode for quickly embedding your site content in WordPress posts, etc.</p>
<p><img src="http://fuelyourcoding.com/files/wordpress_plugins.jpg" alt="wordpress_plugins" title="wordpress_plugins" width="606" height="464" class="aligncenter size-full wp-image-190" /></p>
<h2>Getting Started</h2>
<h3>File Naming</h3>
<p>The first choice you should make is whether you need a single PHP file or a folder with multiple files and assets. Here are some questions help you think through this:</p>
<ul>
<li>Am I going to have associated images, CSS, or JS related to this plugin</li>
<li>Will I have more than one admin panel needed for users to manage this plugin</li>
<li>Will there be multiple distinct pieces to this plugin (i.e. widgets, template tags, etc).</li>
</ul>
<p>If you are building anything more than a simple plugin with a few methods and no associated files, you should go with a directory structure for your plugin.</p>
<p>If we were going to build a plugin called &#8220;Fancy Plugin,&#8221; your file would look like this:</p>
<pre>wp-content/plugins/fancy_plugin.php</pre>
<p>or</p>
<pre>wp-content/plugins/fancy_plugin/fancy_plugin.php</pre>
<p><em>Keep in mind when you name your plugin file that it is unique to what your plugin is and does. Since two plugins cannot both be installed if they have the same file name, be sure to run a Google search and check the <a href="http://wordpress.org/extend/">Extend section of WordPress.org</a> before settling on a name.</em></p>
<h3>Folder Structure</h3>
<p>For complex plugins, I follow this format for my directory structure:</p>
<pre class="brush: plain;">
plugin_folder/
-- plugin_file.php  &lt;= Primary Plugin File
-- css/             &lt;= All CSS
-- images/          &lt;= All Images
-- js/              &lt;= All JS
-- php/             &lt;= Supporting PHP Files
-- views/           &lt;= All Administrative Panels and Metaboxes
</pre>
<h3>Plugin Metadata</h3>
<p>The very first thing you need in your plugin is the metadata block that is used by WordPress to both activate your plugin and notify the user of pertinent information. It should look like this (Taken directly from <a href="http://codex.wordpress.org/Writing_a_Plugin">&#8220;Writing a Plugin&#8221;</a>:</p>
<pre class="brush: php;">&lt;?php
/*
	Plugin Name: Name Of The Plugin
	Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
	Description: A brief description of the Plugin.
	Version: The Plugin's Version Number, e.g.: 1.0
	Author: Name Of The Plugin Author
	Author URI: http://URI_Of_The_Plugin_Author
*/
?&gt;
</pre>
<p>This metadata block is a simple cut and paste into your primary plugin PHP file.</p>
<h2>Extending WordPress With Your Plugin</h2>
<h3>Template Tags</h3>
<p>One of the most simple things your plugin can do, is offer custom template tags for use in your themes. Template tags are just PHP functions. A good rule of thumb is to follow the direction of the WP team by prefixing functions that return data with <strong>get_</strong>, and functions that echo out directly with <strong>the_</strong>. For example:</p>
<pre class="brush: php;">
function get_map_widget_code(){
	return &quot;&lt;script src='...'&gt;My really long widget code...&lt;/script&gt;&quot;;
}

function the_map_widget_code(){
	echo get_map_widget_code();
}
</pre>
<p>These functions could then be used in any theme like this:</p>
<pre class="brush: xml;">
&lt;p&gt;The two ways to use these template tags are echo it myself:&lt;/p&gt;
&lt;?php echo get_map_widget_code() ?&gt;
&lt;p&gt; or let the function echo it (cleaner): &lt;/p&gt;
&lt;?php the_map_widget_code() ?&gt;
</pre>
<p>Template Tags, like all top level functions, have to be unique across the entire set of plugins, WP Core, and theme files. Be sure to choose names that are unique enough as not to conflict with existing method names.</p>
<h3>Shortcodes</h3>
<p>Shortcodes were introduced in WordPress 2.5 and allows the programmer to solve some complex HTML problems in an extremely easy way. Perhaps you want to provide an easy way for a client to list a few products on any page or post. You could just give them the HTML, and tell them to be sure to copy it anywhere they want products&#8230; but we all know how well instructions like those work out. Instead, you should provide a simple short code for them to use:</p>
<pre class="brush: plain;">
[products]
[product name=&quot;My Special Product&quot; price=3.99]
[product name=&quot;An Amazing Book&quot; price=12.99]
[/products]
</pre>
<p>That is a lot easier for a client to remember than a bunch of nested HTML that they have to switch into HTML view to edit or create. Here is the PHP code that would allow this shortcode to function:</p>
<pre class="brush: php;">
function products_shortcode_callback( $atts, $content=null ){
	// Set a blank return by default
	$ret = &quot;&quot;;

	// If there is content between the shortcodes
	// then add our wrapping tags
	if($content){
		$ret = '&lt;ul class=&quot;products in-post-products&quot;&gt;';

		// Nested shortcodes are not processed by default
		// be sure to make this call if you want
		// to process nested shortcodes
		$ret .= do_shortcode($content);

		$ret .= '&lt;/ul&gt;';
	}

	// Never echo output from a shortcode function!!!
	return $ret;
}

function product_shortcode_callback( $atts ){
	// Get the attributes and filter out
	// unwanted attributes
	$a = shortcode_atts( array(
		'name' =&gt; 'Product Name',
		'price' =&gt; 'No Price'), $atts );

	// Prepend a $ sign if price is supplied
	if ($a['price'] != 'No Price') $a['price'] = '$' . $a['price'];

	// Build HTML
	$ret = &quot;&lt;li&gt;&lt;span class='product-name'&gt;&quot;;
	$ret .= $a['name'] . &quot;&lt;/span&gt;&lt;br /&gt;&quot;;
	$ret .= '&lt;span class=&quot;price&quot;&gt;' . $a['price'];
	$ret .= '&lt;/span&gt;&lt;/li&gt;';

	// Again, return NOT echo:
	return $ret;
}

// Finally, add the shortcodes to the system
// So WordPress knows about them
add_shortcode( &quot;products&quot;, &quot;products_shortcode_callback&quot; );
add_shortcode( &quot;product&quot;, &quot;product_shortcode_callback&quot; );
</pre>
<p>As you have seen twice in the comments of the previous code example, <strong>NEVER echo output from a shortcode!</strong> Be sure to always return the content so it can be inserted in the correct place.</p>
<p>The previous code example would replace the shortcodes with this HTML (lines split for clarity):</p>
<pre class="brush: xml;">
&lt;ul class=&quot;products in-post-products&quot;&gt;
&lt;li&gt;&lt;span class=&quot;product-name&quot;&gt;My Special Product&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;price&quot;&gt;$3.99&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;product-name&quot;&gt;An Amazing Book&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;price&quot;&gt;$12.99&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p><strong>Reference Links</strong></p>
<ul>
<li><a title="WordPress Codex: Shortcode API" href="http://codex.wordpress.org/Shortcode_API">Shortcode API</a></li>
</ul>
<h3>Filters and Actions</h3>
<p>Much of your extensions to the WordPress core will happen with Filters and Actions. Thankfully, they are pretty easy to understand! A filter simply sends you content at the appropriate time, and expects content in return. Be sure to check the documentation on WordPress.org when creating filters because certain filters will pass you more than one parameter. The following code will add text before and after each post title:</p>
<pre class="brush: php;">
function add_text_to_title( $title ){
	return 'Text Before &lt;&lt; ' . $title . ' &gt;&gt; And After';
}
// Register filter with WP
add_filter( &quot;the_title&quot;, &quot;add_text_to_title&quot; );
</pre>
<p>Actions are called when certain actions are about to happen or have just happened. Actions allow you to execute your code at the appropriate time. The following code adds a javascript file to each page of the front-end site:</p>
<pre class="brush: php;">
function add_special_scripts(){
	wp_2_enqueue_script(
		'special_script',
		plugins_url('/test/special.js'),
		array( 'jquery' ), // require jquery
		'0.1' // Helps with cacheing
	);
}
// Register the action with WP
add_action(&quot;wp_2_print_scripts&quot;, &quot;add_special_scripts&quot;);
</pre>
<p><strong>Reference Links</strong></p>
<ul>
<li><a title="WordPress Codex: Plugin API/Action Reference" href="http://codex.wordpress.org/Plugin_API/Action_Reference">Plugin API/Action Reference</a></li>
<li><a title="WordPress Codex: Plugin API/Filter Reference" href="http://codex.wordpress.org/Plugin_API/Filter_Reference">Plugin API/Filter Reference</a></li>
</ul>
<h3>Widgets, Pluggable Functions, Settings, and User Interaction</h3>
<p>Some of the more advanced techniques of building plugins, including user interaction through admin menus, storing settings in the database, and writing a sidebar widget will be covered in an upcoming article.</p>
<h2>Closing Advice</h2>
<ol>
<li>When you begin to extend WordPress through plugins or theme additions, make the <a title="WordPress Codex" href="http://codex.wordpress.org/Main_Page">Codex</a> your best friend. The amount of developer documentation availible is amazing and extremely helpful.</li>
<li>If you cannot find documentation on a particular function or hook, do a global search of your WordPress installation (Cmd+Shift+F in TextMate) to look for the definition of the function. Often looking at the source will give you an idea how it works.</li>
<li>Make sure you have PHP errors turned on locally, or have access to your PHP error log to troubleshoot your development. Not being able to catch small PHP errors can make your life miserable.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://fuelyourcoding.com/getting-started-writing-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Wordpress theme frameworks</title>
		<link>http://fuelyourcoding.com/wordpress-theme-frameworks/</link>
		<comments>http://fuelyourcoding.com/wordpress-theme-frameworks/#comments</comments>
		<pubDate>Tue, 26 May 2009 23:20:16 +0000</pubDate>
		<dc:creator>Gaya Kessler</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Plugins / Add-Ons]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[hybrid]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[thematic]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://fuelyourcoding.com/?p=172</guid>
		<description><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
]]></description>
			<content:encoded><![CDATA[<p><p><a href="http://rss.buysellads.com/click.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" target="_blank"><img src="http://rss.buysellads.com/img.php?z=1271313&k=f16d4ddc81a95a47348dcddb230bad58&a=<?php echo($a); ?>&c=<?php echo(rand()); ?>" border="0" alt="" /></a></p><p><a href="http://buysellads.com/buy/sitedetails/pubkey/f16d4ddc81a95a47348dcddb230bad58/zone/1271313" target="_blank">Advertise here via BSA</a></p></p>
<p>You got to love <a href="http://codex.wordpress.org/Theme_Frameworks">Wordpress theme frameworks</a> when trying to put together a theme for Wordpress.</p>
<p>There are various reasons to use a framework. As you might know, frameworks provide you with convenience and code that you don&#8217;t have to write all over. <a href="http://fuelyourcoding.com/getting-to-know-cakephp-part-1">Robin&#8217;s article about CakePHP</a> is about a PHP Framework which will speed up your development.</p>
<p>A few reasons you should use Wordpress Frameworks:</p>
<ul>
<li>Save development time</li>
<li>Have the HTML layout ready to use and valid</li>
<li>Some SEO included</li>
<li>No need to make all the template pages yourself</li>
<li>You won&#8217;t forget to put in Wordpress features that quick</li>
<li>Loops are already written for most pages</li>
</ul>
<p>I&#8217;ve been using theme frameworks to get themes implemented for some time now and I must say I am very pleased with the results. I got the projects up and running in no time! It&#8217;s a real life saver if you have little time.</p>
<p>What it does is quite simple: being a basic template for your theme. You&#8217;ll only need to style the HTML and adjust anything in it.</p>
<p>It&#8217;s just a theme with nothing in it but HTML, template tags and some basic styling ready. You&#8217;ll have to download the theme, adjust it, upload it and use it in Wordpress. It&#8217;s as simple as that! No need for any special installation on your server or anything.</p>
<p>The following Wordpress theme frameworks are quite famous:</p>
<ul>
<li> <a href="http://www.plaintxt.org/themes/sandbox/">Sandbox</a><br />
The framework I&#8217;ve been using for a while now. Must say I am very pleased with how it&#8217;s put together.<br />
Uses very strong HTML and is really easy to adjust.</li>
</ul>
<p><a href="http://www.plaintxt.org/themes/sandbox/"></a><a href="http://www.plaintxt.org/themes/sandbox/"><img class="aligncenter size-full wp-image-178" title="Sandbox" src="http://fuelyourcoding.com/files/framework-sandbox.jpg" alt="Sandbox" width="606" height="300" /></a></p>
<ul>
<li> <a href="http://themeshaper.com/thematic/">Thematic</a><br />
Has a bit more going on with styling than Sandbox and might make it easier for beginners to work with. Great integration of widget areas and implementations of various plugins. Looks nice too!</li>
</ul>
<p><a href="http://themeshaper.com/thematic/"><img class="aligncenter size-full wp-image-179" title="Thematic" src="http://fuelyourcoding.com/files/framework-thematic.jpg" alt="Thematic" width="606" height="305" /></a></p>
<ul>
<li> <a href="http://themehybrid.com/themes/hybrid">Hybrid</a><br />
Even more themed than Sandbox and Themematic. Easy to configure and gets a beginner going in minutes! Really nice to try out and build your next theme on.</li>
</ul>
<p><a href="http://themehybrid.com/themes/hybrid"><img class="aligncenter size-full wp-image-180" title="Hybrid" src="http://fuelyourcoding.com/files/framework-hybrid.jpg" alt="Hybrid" width="606" height="249" /></a></p>
<p>Feel free to share your thoughts and experiences with theme frameworks in the comments. I&#8217;d love to hear your stories!</p>
]]></content:encoded>
			<wfw:commentRss>http://fuelyourcoding.com/wordpress-theme-frameworks/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

