<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Eric Barnes</title>
	
	<link>http://ericlbarnes.com</link>
	<description>Business, Customer Service, and Software Development</description>
	<lastBuildDate>Fri, 10 Jul 2009 14:05:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/EricLBarnes" type="application/rss+xml" /><feedburner:emailServiceId>EricLBarnes</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>CodeIgniter Authorization</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/iOEyh8-_mdU/</link>
		<comments>http://ericlbarnes.com/blog/develop/codeigniter-authorization/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 14:05:53 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=369</guid>
		<description><![CDATA[Today I wanted to showcase some of the popular authorization systems that work with CodeIgniter.  From what I can see this is one of the biggest areas the framework is missing.  But I also see their point of view because everyone and their brother wants a different setup or want to it perform [...]]]></description>
			<content:encoded><![CDATA[<p>Today I wanted to showcase some of the popular authorization systems that work with CodeIgniter.  From what I can see this is one of the biggest areas the framework is missing.  But I also see their point of view because everyone and their brother wants a different setup or want to it perform differently. </p>
<p><strong><a href="http://codeigniter.com/wiki/DX_Auth/">DX Auth</a></strong><br />
DX Auth is an authentication library for Code Igniter. It’s goal to enable you to easily include secure and easy to use authentication library to your project, while giving you the flexibility to choose from simple authentication system to full fledged authentication system.</p>
<p><strong><a href="http://codeigniter.com/wiki/Erkana/">Erkana</a></strong><br />
My goal with this library was to create a small set of methods and helpers that would prove useful for a variety of user authentication while not hijacking the framework and forcing you to adopt the practices that library dictates.</p>
<p><strong><a href="http://freakauth.4webby.com/">FreakAuth</a></strong><br />
Mammoth authorization system for CodeIgniter.</p>
<p><strong><a href="http://codeigniter.com/wiki/SimpleLoginSecure/">Simple Login Secure</a></strong><br />
Simplelogin is designed to give you a quick and simple login library that will get you up and running with an unobtrusive authorization system very quickly. It does not try to guess how you want to structure your app, it simply tries to give you a little help.</p>
<p><strong><a href="http://codeigniter.com/wiki/The_Auth_Library/">The Auth Library</a></strong><br />
The Auth Library is a small but powerful authentication library for CodeIgniter.</p>
<p><strong><a href="http://www.bramme.net/2008/07/auth-library-for-codeigniter-tutorial/">Auth library for CodeIgniter tutorial</a></strong><br />
For me personally I like this one the best.  It is very simple and just enough to get started with out having tons of files to have to wade through. </p>
<p>What are your thoughts which one do you use and why? </p>
<p>Be sure and read my other <a href="http://ericlbarnes.com/tag/codeigniter/">CodeIgniter tips</a>!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=iOEyh8-_mdU:B95IDjQzRac:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=iOEyh8-_mdU:B95IDjQzRac:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=iOEyh8-_mdU:B95IDjQzRac:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=iOEyh8-_mdU:B95IDjQzRac:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=iOEyh8-_mdU:B95IDjQzRac:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/develop/codeigniter-authorization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/develop/codeigniter-authorization/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter Custom Settings File</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/SsWSEz7Plq8/</link>
		<comments>http://ericlbarnes.com/blog/develop/codeigniter-custom-settings-file/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 19:12:11 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=371</guid>
		<description><![CDATA[For today I am going to show you how to create a settings.php file to store your database connection and general config settings. The reason I use this method is because I am creating applications for general public usage and not all want or care about the framework driving the site.  They just need [...]]]></description>
			<content:encoded><![CDATA[<p>For today I am going to show you how to create a settings.php file to store your database connection and general config settings. The reason I use this method is because I am creating applications for general public usage and not all want or care about the framework driving the site.  They just need a simple way to add their details and then have the script running. For this reason I create the settings.php in the site root which does two things. 1. Keeps them from having to edit files a few folders deep. 2. Simplifies the release package by not overwriting their files during upgrades. </p>
<p>My basic setup is like this.  First create the settings.php file. Second I open up the config/database.php and copy the values into my settings file. Third I open config/config.php and find any items that I think a user would want to change or should change. I never include things in the settings file that is dependent on my setup such as prefix, query strings, etc. </p>
<p>Once everything is in my settings file I alter the config/database.php and delete all the $db array values. Then I add: </p>
<pre>
$active_group = "default";
$active_record = TRUE;
include(APPPATH .'/settings.php');
</pre>
<p>Then for the config/config.php file I do basically the same thing. Delete everything I included in the settings.php file and then at the top add: </p>
<pre>
include(APPPATH .'/settings.php');
</pre>
<p>Because the database and config files use a different array it doesn&#8217;t clash by including this file in both places. </p>
<p>Be sure and read my other <a href="http://ericlbarnes.com/tag/codeigniter/">CodeIgniter tips</a>!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=SsWSEz7Plq8:hzw1Dsk5JWs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=SsWSEz7Plq8:hzw1Dsk5JWs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=SsWSEz7Plq8:hzw1Dsk5JWs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=SsWSEz7Plq8:hzw1Dsk5JWs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=SsWSEz7Plq8:hzw1Dsk5JWs:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/develop/codeigniter-custom-settings-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/develop/codeigniter-custom-settings-file/</feedburner:origLink></item>
		<item>
		<title>Optimize and Repair A Database With CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/bsCOuqF1uAQ/</link>
		<comments>http://ericlbarnes.com/blog/develop/codeigniter-database-utilities/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 12:01:54 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=373</guid>
		<description><![CDATA[Today I wanted to show you an easy way to use the CodeIgniter database utilities class to repair or  optimize your database. 
First off lets take a look at the repair utility. By the user guide it is accessed like this: 

if ($this->dbutil->repair_table('table_name'))
{
    echo 'Success!';
}

As you can see it is very [...]]]></description>
			<content:encoded><![CDATA[<p>Today I wanted to show you an easy way to use the <a href="http://codeigniter.com/user_guide/database/utilities.html">CodeIgniter database utilities class</a> to repair or  optimize your database. </p>
<p>First off lets take a look at the repair utility. By the user guide it is accessed like this: </p>
<pre>
if ($this->dbutil->repair_table('table_name'))
{
    echo 'Success!';
}
</pre>
<p>As you can see it is very simple and straight forward. You replace &#8216;table_name&#8217; with yours and then it repairs it. This is great but most databases have a lot of tables and instead of writing out each table name you can use the nice list_tables function.  Here is an example: </p>
<pre>
$tables = $this->db->list_tables();
foreach($tables as $table)
{
	if ($this->dbutil->repair_table($table))
	{
		$tb[]=$table;
	}
}
$data['repaired']=$tb;
</pre>
<p>The same code can be used for optimize as well just replace the repair_table with optimize_table.  </p>
<p>Be sure and read my other <a href="http://ericlbarnes.com/tag/codeigniter/">CodeIgniter tips</a>!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=bsCOuqF1uAQ:bMkTR8RnTDA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=bsCOuqF1uAQ:bMkTR8RnTDA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=bsCOuqF1uAQ:bMkTR8RnTDA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=bsCOuqF1uAQ:bMkTR8RnTDA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=bsCOuqF1uAQ:bMkTR8RnTDA:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/develop/codeigniter-database-utilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/develop/codeigniter-database-utilities/</feedburner:origLink></item>
		<item>
		<title>Extending the core Controller in CodeIgniter</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/qE7dL5JdC9s/</link>
		<comments>http://ericlbarnes.com/blog/develop/extending-the-core-controller-in-codeigniter/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 13:51:03 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=372</guid>
		<description><![CDATA[Today I want to discuss extending the core Controller class in CodeIgniter.  When developing 68KB I ran into a tricky situation where I needed to auto load several plugins, libraries, and models but they rely on the database which is not setup until the install is ran. So I had to do some outside [...]]]></description>
			<content:encoded><![CDATA[<p>Today I want to discuss extending the core Controller class in CodeIgniter.  When developing <a href="http://68kb.com">68KB</a> I ran into a tricky situation where I needed to auto load several plugins, libraries, and models but they rely on the database which is not setup until the install is ran. So I had to do some outside the box thinking and some tinkering to get this working. But in the end it worked great and was very simple to do. <span id="more-372"></span></p>
<p>Step 1 is to create a My_controller.php file inside the libraries folder of application.  Of course change &#8220;My&#8221; with your prefix setup in config. </p>
<p>Step 2. is to add this code to this file: </p>
<pre>
&lt;?php if (!defined(&#x27;BASEPATH&#x27;)) exit(&#x27;No direct script access allowed&#x27;);
class core_Controller extends Controller
{
	function __construct()
	{
		parent::Controller();
		$this->setup();
	}

	// ------------------------------------------------------------------------

	/**
	* Setup the autoloaded items
	*/
	function setup()
	{
		if ($this->db->table_exists('sessions'))
		{
			$this->load->library('session');
			$this->load->library('auth');
			$this->load->helper('price');
			$this->load->helper('image');
			$this->load->helper('html');
		}
		else
		{
			redirect('setup');
		}
	}
}
</pre>
<p>The final step is in ALL your controllers besides the ones used in install is to extend this class. Example: </p>
<pre>class Mycontroller extends core_Controller {</pre>
<p>Now you can auto load anything you need and not have to rely on the default <a href="http://codeigniter.com/user_guide/general/autoloader.html">autoloader</a>.</p>
<p>Be sure and read my other <a href="http://ericlbarnes.com/tag/codeigniter/">CodeIgniter tips</a>!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=qE7dL5JdC9s:B8QMefUcm0g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=qE7dL5JdC9s:B8QMefUcm0g:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=qE7dL5JdC9s:B8QMefUcm0g:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=qE7dL5JdC9s:B8QMefUcm0g:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=qE7dL5JdC9s:B8QMefUcm0g:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/develop/extending-the-core-controller-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/develop/extending-the-core-controller-in-codeigniter/</feedburner:origLink></item>
		<item>
		<title>CodeIgniter – Change Views Location</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/cegPOk8Yta0/</link>
		<comments>http://ericlbarnes.com/blog/develop/codeigniter-change-views-location/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 11:21:41 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=389</guid>
		<description><![CDATA[This is the first post in what is going to be CodeIgniter week here at Eric Barnes. I have been using CodeIgniter a lot and thought it would be good to share some of the tips and tricks I have learned over the past few years. Now with the intro out of the way lets [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first post in what is going to be CodeIgniter week here at Eric Barnes. I have been using CodeIgniter a lot and thought it would be good to share some of the tips and tricks I have learned over the past few years. Now with the intro out of the way lets jump in. <img src='http://ericlbarnes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Some people, most notably me, want to change where the view files are located in a CodeIgniter application.  Here is a quick tip that I do, should you want to make the same change. </p>
<p>For my setup I like to have a template folder in the root to house my view files. So in order to get CodeIgniter to use this directory you have two options. </p>
<p>1. Is to edit system/libraries/Loader.php. Search for and change: </p>
<pre>$this->_ci_view_path = 'templates/';</pre>
<p>Please note that I assigned the root folder to the php include path. </p>
<p>2. Is a more preferred method and for it you make a copy Loader.php and make the same change above. But put the copy in your application/libraries/ folder. This is a better option because you are not altering any of the core files and upgrades will be easier later on. </p>
<p>Be sure and subscribe to my <a href="http://feeds.feedburner.com/EricLBarnes">Feed</a> to get the rest of the CodeIgniter tips. </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=cegPOk8Yta0:obb8vje4cSo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=cegPOk8Yta0:obb8vje4cSo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=cegPOk8Yta0:obb8vje4cSo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=cegPOk8Yta0:obb8vje4cSo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=cegPOk8Yta0:obb8vje4cSo:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/develop/codeigniter-change-views-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/develop/codeigniter-change-views-location/</feedburner:origLink></item>
		<item>
		<title>Busy day</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/wPlm_PkEF9Q/</link>
		<comments>http://ericlbarnes.com/blog/customer-service/busy-day/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 10:00:19 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Customer Service]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=394</guid>
		<description><![CDATA[
Screenshot of 269 tickets in support desk on my iPhone.  
]]></description>
			<content:encoded><![CDATA[<p><img src="http://ericlbarnes.com/wp-content/uploads/2009/07/l_802_802_1AEBA3FE-64FA-4428-BF04-274BFD88035D.jpeg" alt="" width="300" height="300" class="aligncenter size-full wp-image-364" /></p>
<p>Screenshot of 269 tickets in support desk on my iPhone.  </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=wPlm_PkEF9Q:vrD6i5M_Lv8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=wPlm_PkEF9Q:vrD6i5M_Lv8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=wPlm_PkEF9Q:vrD6i5M_Lv8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=wPlm_PkEF9Q:vrD6i5M_Lv8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=wPlm_PkEF9Q:vrD6i5M_Lv8:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/customer-service/busy-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/customer-service/busy-day/</feedburner:origLink></item>
		<item>
		<title>68 Classifieds – The Power of Includes</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/oUU5SMkw_pc/</link>
		<comments>http://ericlbarnes.com/68classifieds/tips/68-classifieds-the-power-of-includes/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 16:38:19 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[68c-tips]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=386</guid>
		<description><![CDATA[One great feature that I don&#8217;t see used all to often is include templates.  These give you the ability to break your template down into small workable sections and include them as needed.  For the latest site I built I used these in lots of places and it made my job a whole [...]]]></description>
			<content:encoded><![CDATA[<p>One great feature that I don&#8217;t see used all to often is include templates.  These give you the ability to break your template down into small workable sections and include them as needed.  For the latest site I built I used these in lots of places and it made my job a whole lot easier. </p>
<p>Include templates can be used for anything and I have seen them used for headers, footers, sidebars, etc.  But what brings you lots of power is to use include templates inside loops, assigning them to variables, and adding variables to the includes. </p>
<p><span id="more-386"></span></p>
<h3>Includes In Loops</h3>
<p>Take for example the showlistings template file. The standard one has a foreach loop which handles displaying the listings in a table. It looks like this: </p>
<pre>
{foreach from=$results item="entry"}
{$entry.title}
{/foreach}
</pre>
<p>To convert this to an include you would do this: </p>
<pre>
{foreach from=$results item="entry"}
{include file="inc/inc_results.tpl" entry=$entry}
{/foreach}
</pre>
<p>Then in your inc/inc_results.tpl file add the part that would be looped over: </p>
<pre>
{$entry.title}
{$entry.price|format_money}
</pre>
<p>Of course this is very basic but if you have an advanced layout for your internal items then this is a life saver in simplifying it. </p>
<h3>Assign Includes</h3>
<p>Another wonderful feature is assigning an include file. This can be done like this: </p>
<pre>{include file='inc/inc_sidebar.tpl' assign=navbar}</pre>
<p>Then any where else in your template you need the side bar you would just add:</p>
<pre>{$navbar}</pre>
<p>This is really helpful if you have something that needs to be shared. For example at the top a list of links and then in the footer that same list. </p>
<h3>Includes With Variables</h3>
<p>The final section to this post is including a file with variables. For this lets pretend we are creating a header include. A common header needs a title, keywords, and description. So your include would look like this: </p>
<pre>{include file="inc/inc_header.tpl" title="Your Title" keywords="key,word,here" description="Description Here"}</pre>
<p>Then in your template:</p>
<pre>

<meta name="Keywords" content="{$keywords}" />
<meta name="Description" content="{$description}" />
</pre>
<p>Hopefully this post will show the great flexibility in the 68 Classifieds template system and give you ideas in making your templates easier to manage. </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=oUU5SMkw_pc:NjDLl_2pdhM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=oUU5SMkw_pc:NjDLl_2pdhM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=oUU5SMkw_pc:NjDLl_2pdhM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=oUU5SMkw_pc:NjDLl_2pdhM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=oUU5SMkw_pc:NjDLl_2pdhM:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/68classifieds/tips/68-classifieds-the-power-of-includes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/68classifieds/tips/68-classifieds-the-power-of-includes/</feedburner:origLink></item>
		<item>
		<title>Building a news module – 68 Classifieds</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/qDbEoMGaaOE/</link>
		<comments>http://ericlbarnes.com/68classifieds/tips/building-a-news-module-68-classifieds/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 16:19:21 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[68c-tips]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=385</guid>
		<description><![CDATA[Today I decided I should share how I built the news module for a recent site I worked on. The goal of this tutorial is to hopefully help you better understand the 68 Classifieds module system and how to build your own modules. For this tutorial I kept the module pretty basic but it should [...]]]></description>
			<content:encoded><![CDATA[<p>Today I decided I should share how I built the news module for a recent site I worked on. The goal of this tutorial is to hopefully help you better understand the 68 Classifieds module system and how to build your own modules. For this tutorial I kept the module pretty basic but it should do just enough to be a workable system.<br />
<span id="more-385"></span></p>
<p>Before we get started you should <a href="http://ericlbarnes.com/downloads/news_module.zip">download the source files</a> so you can follow along. </p>
<p>If you are ready lets jump right in.  The requirements of any module are pretty simple and it is a config.php which is used for the installation.  Beyond that you can have a hooks.php file to enteract with the core, an index.php and admin.php which allows you to view them from the template, and finally an init.php file which handles installing, upgrading, and deleting. </p>
<h3>Config File</h3>
<p>The first thing I always do is build the config.php file. Inside this file it has: </p>
<pre>
&lt;?php
$data['module']['name'] = "news";
$data['module']['displayname'] = 'News';
$data['module']['description'] = "Allows you to add news";
$data['module']['version'] = "v1.0";
$data['module']['admin_capable'] = "1";
$data['module']['user_capable'] = "1";
</pre>
<p>Each line basically tells the system something about your module. </p>
<p>Name &#8211; Is the module folder name.<br />
Display Name &#8211; Is what is shown in the administration<br />
Description &#8211; Is what is shown in the administration<br />
Version &#8211; This the version number of the module<br />
Admin Capable &#8211; This tells the system it has an admin file.<br />
User Capable &#8211; This tells the system it can be accessed from your sites frontend. </p>
<h3>Init File</h3>
<p>The next step I did was create the init.php file so I could add a new table to the db. </p>
<p>This file as you can see includes three functions. install, upgrade, and uninstall. These are used for adding tables or altering existing ones. If you look at the install function I am just adding a new &#8220;posts&#8221; table to hold our news items. The upgrade is not used and the delete function drops the table. </p>
<h3>News Class</h3>
<p>Now we are going to create a news class file. This file will handle everything needed in the news system. Basically adding, updating, deleting, etc.. In the source download this is name &#8220;news_class.php&#8221;.  I will not really go through all the code because it should be pretty straightforward. The only thing that is complex is the getNews method which uses a few internal classes to build the results. This also handles the sorting, searching, and displaying the items. </p>
<h3>Admin</h3>
<p>The admin.php file is used so the administrator can add/edit/delete news entries. The code at the top includes the necessary class files and also instantiates the news class. </p>
<pre>
require_once(FILESYSTEM_PATH .'includes/classes/kernel/Pagination.php');
require_once(FILESYSTEM_PATH .'includes/classes/wrapper/SuperglobalWrapper.php');
require_once(FILESYSTEM_PATH.'/modules/news/news_class.php');
$News=new News();
</pre>
<p>The pagination and wrapper files are the ones needed for paging so they must be included first. Then is the include for the news class. After that it is just a bunch of if else statements to determine what action is taking place. </p>
<h3>Index</h3>
<p>The index.php is very similar to the admin.php file with the exception it is only used on your sites frontend and will be responsible for showing your visitors the news. </p>
<p>The one difference is this code: </p>
<pre>
if(!defined('MAX_ROWS_SEARCH')) {
	define('MAX_ROWS_SEARCH', '5');
}
</pre>
<p>This the number of search results or items you want shown in the list. </p>
<h3>Hooks</h3>
<p>For our news module I created two hooks and you can see them in the hooks.php file. This file is used to interact with the core system and when a hook is called it will run the code in this file. </p>
<p>As you can see in the constructor I registered the two hooks. </p>
<pre>
function news_events(&#038;$modules)
{
	$modules->register('admin_tpl_layout_settings', $this, 'add_link');
	$modules->register('index', $this, 'home_page');
}
</pre>
<p>In those register statements the first parameter is the hook name. The second is the class. And the third is the method in the class.  So for the first one I am using the admin_tpl_layout_settings hook, the news_events class, and finally the add_link method inside this class. </p>
<p>That hook is very simple and all it does is display a link in your administration to manage your news. It will be shown under the settings tab. </p>
<p>The second hook is a custom one I created just for this module. I wanted to show the last three news items on the home page.  What this does is query the database and add the results to an array which is assigned to the blog variable. With that you can edit your home.tpl template and add a foreach loop to show the latest three. </p>
<pre>
{foreach from=$blog item=entry}
&lt;div class=&quot;newsbox&quot;&gt;
	&lt;h3&gt;{$entry.post_title}&lt;/h3&gt;
	&lt;div class=&quot;entry&quot;&gt;
		{$entry.post_content|truncate:150:&quot;...&quot;:true}
		&lt;p&gt;&lt;a href=&quot;modules?mod=news&amp;amp;ID={$entry.ID}&quot;&gt;Continue Reading&lt;/a&gt;&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;
{/foreach}
</pre>
<h3>Templates</h3>
<p>The templates folder of this module just contains the templates used in showing the news to a site visitor and for the administration. For the front end I named them &#8220;the_entry.tpl&#8221; and &#8220;the_posts.tpl&#8221;. The entry is a single item whereas the_posts is the list. </p>
<h3>Wrap Up</h3>
<p>In closing I hope this helps you better understand how to build a 68 Classifieds module and how everything all ties together. Also I know this module is very basic so for home work why not try to add more features to it? </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=qDbEoMGaaOE:grdZRiySWyA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=qDbEoMGaaOE:grdZRiySWyA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=qDbEoMGaaOE:grdZRiySWyA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=qDbEoMGaaOE:grdZRiySWyA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=qDbEoMGaaOE:grdZRiySWyA:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/68classifieds/tips/building-a-news-module-68-classifieds/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/68classifieds/tips/building-a-news-module-68-classifieds/</feedburner:origLink></item>
		<item>
		<title>SVN Export Just Changed Files</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/NulsRfRdnfU/</link>
		<comments>http://ericlbarnes.com/blog/develop/svn-export-just-changed-files/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:55:41 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=387</guid>
		<description><![CDATA[Something I have wanted to do for a long time is figure out how to export just the changed files between revisions of a SVN repository.  To be honest I have searched for this functionality for a while now, probably over a year, and I never could find anything simple and easy that I [...]]]></description>
			<content:encoded><![CDATA[<p>Something I have wanted to do for a long time is figure out how to export just the changed files between revisions of a SVN repository.  To be honest I have searched for this functionality for a while now, probably over a year, and I never could find anything simple and easy that I could use. With exception of Tortoise SVN which is only for windows. <img src='http://ericlbarnes.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  </p>
<p>But today just now all that changed.  I found this great little bash script on <a href="http://idn.interspire.com/blogs/6/Exporting-only-the-files-changed-between-2-revisions-in-Subversion.html">Interspire&#8217;s Developer Network</a>. </p>
<p>Here is the nice gem of code: </p>
<pre>
for i in $(svn diff --summarize -r 1403:1438 http://server/svn/project/trunk |
awk '{ print $2 }'); do p=$(echo $i | sed -e 's{http://server/svn/project/trunk/{{');
mkdir -p $(dirname $p); svn export $i $p; done
</pre>
<p>I know not very exciting to most folks but a real great find to me and probably my customers too. <img src='http://ericlbarnes.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>PS: Be looking out for diff downloads in our next release. </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=NulsRfRdnfU:2D6zJo37670:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=NulsRfRdnfU:2D6zJo37670:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=NulsRfRdnfU:2D6zJo37670:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=NulsRfRdnfU:2D6zJo37670:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=NulsRfRdnfU:2D6zJo37670:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/blog/develop/svn-export-just-changed-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/blog/develop/svn-export-just-changed-files/</feedburner:origLink></item>
		<item>
		<title>68 Classifieds – TextMate Bundle</title>
		<link>http://feedproxy.google.com/~r/EricLBarnes/~3/WgfgpwdHhsw/</link>
		<comments>http://ericlbarnes.com/68classifieds/tips/68-classifieds-textmate-bundle/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 18:25:44 +0000</pubDate>
		<dc:creator>Eric Barnes</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[68c-tips]]></category>
		<category><![CDATA[smarty]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://ericlbarnes.com/?p=384</guid>
		<description><![CDATA[I am not sure how many people using 68 Classifieds that also use TextMate but I wanted to share two of my favorite bundles that have saved me numerous hours over the years. 
The first one is PHP Smarty available from the TextMate SVN and Mike Zornek has instructions for installing it. This one has [...]]]></description>
			<content:encoded><![CDATA[<p>I am not sure how many people using 68 Classifieds that also use TextMate but I wanted to share two of my favorite bundles that have saved me numerous hours over the years. </p>
<p>The first one is PHP Smarty available from the TextMate SVN and <a href="http://blog.clickablebliss.com/2006/01/04/teach-textmate-about-smarty/">Mike Zornek</a> has instructions for installing it. This one has been a life safer for me when building custom templates or just altering existing ones. </p>
<p>The next one is a completely custom one I built. Although very basic it does a few important things. 1. It auto creates a module config file, 2. It auto creates the hooks file, and finally it auto creates the core layout template.  Here is the link to the direct download for those interested. </p>
<p>&raquo; <a href="http://ericlbarnes.com/downloads/68classifieds v4_1_4.tmbundle">Download 68 Classifieds TextMate bundle</a>.</p>
<p>With these two plugins installed TextMate is now my text editor of choice. It is small, simple, and very light weight yet still functions amazingly. </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=WgfgpwdHhsw:kW3SnYrlYgo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=WgfgpwdHhsw:kW3SnYrlYgo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=WgfgpwdHhsw:kW3SnYrlYgo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EricLBarnes?a=WgfgpwdHhsw:kW3SnYrlYgo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EricLBarnes?i=WgfgpwdHhsw:kW3SnYrlYgo:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ericlbarnes.com/68classifieds/tips/68-classifieds-textmate-bundle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ericlbarnes.com/68classifieds/tips/68-classifieds-textmate-bundle/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.493 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-07-10 09:07:19 -->
