<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: CodeIgniter model productivity methods</title>
	<link>http://pr0digy.com/codeigniter/model-productivity-methods/</link>
	<description>Web development with CodeIgniter and Mootools.</description>
	<pubDate>Wed, 10 Mar 2010 18:02:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Alex</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-2623</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 01 Aug 2009 09:50:41 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-2623</guid>
		<description>Yesdi, CI doesn't use ORM at all, so you can have any attributes or methods in your models.  Instead of ORM, CI uses ActiveRecord, which essentially is a query builder.

If you are more comfortable with ORM, then you might want to take a look at &lt;a href="http://www.kohanaphp.com/" rel="nofollow"&gt;Kohana&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Yesdi, CI doesn&#8217;t use ORM at all, so you can have any attributes or methods in your models.  Instead of ORM, CI uses ActiveRecord, which essentially is a query builder.</p>
<p>If you are more comfortable with ORM, then you might want to take a look at <a href="http://www.kohanaphp.com/" rel="nofollow">Kohana</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yesdi</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-2620</link>
		<dc:creator>Yesdi</dc:creator>
		<pubDate>Fri, 31 Jul 2009 19:36:34 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-2620</guid>
		<description>Great tip !  I'm a newbie to CI though I've worked with other MVC frameworks. My question - can I have variables in my model class that are not meant to be stored the db ? For example, in the code above - I'ld like to have a member variable called var $dbname='users' so that I dont have to put in the db name in each method. How can I do that - just make it a private member var ?</description>
		<content:encoded><![CDATA[<p>Great tip !  I&#8217;m a newbie to CI though I&#8217;ve worked with other MVC frameworks. My question - can I have variables in my model class that are not meant to be stored the db ? For example, in the code above - I&#8217;ld like to have a member variable called var $dbname=&#8217;users&#8217; so that I dont have to put in the db name in each method. How can I do that - just make it a private member var ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodeIgniter Tutorial Collection</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-1758</link>
		<dc:creator>CodeIgniter Tutorial Collection</dc:creator>
		<pubDate>Fri, 13 Feb 2009 18:35:46 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-1758</guid>
		<description>[...] Model productivity methods  (http://pr0digy.com/codeigniter/model-productivity-methods/) [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Model productivity methods  (http://pr0digy.com/codeigniter/model-productivity-methods/) [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spir</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-1516</link>
		<dc:creator>Spir</dc:creator>
		<pubDate>Wed, 24 Dec 2008 09:38:18 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-1516</guid>
		<description>that's awesome, thanks for sharing this!</description>
		<content:encoded><![CDATA[<p>that&#8217;s awesome, thanks for sharing this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-909</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 23 Aug 2008 09:42:07 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-909</guid>
		<description>That's the nice thing about __autoload - you can create your own loading rules based upon class names.  Anyway, I'm glad you finally got it working :)</description>
		<content:encoded><![CDATA[<p>That&#8217;s the nice thing about __autoload - you can create your own loading rules based upon class names.  Anyway, I&#8217;m glad you finally got it working :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gillbates</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-907</link>
		<dc:creator>gillbates</dc:creator>
		<pubDate>Sat, 23 Aug 2008 04:57:53 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-907</guid>
		<description>and.. it works. Awesome!

So I modified the autoloader to only autoload classes with the prefix GILL_


function __autoload($class) {
	
	//only autoload classes containing GILL_
    if(stristr($class, 'GILL_')){
        require_once(PATH_TO_LIBRARIES.&#34;$class.php&#34;);
    }
}

Then I created GILL_MyModel.php in application/libraries containing the following class:

class GILL_MyModel extends Model 

Then my models are defined as such:

class Tourmodel extends GILL_MyModel {

class Subareamodel extends GILL_MyModel</description>
		<content:encoded><![CDATA[<p>and.. it works. Awesome!</p>
<p>So I modified the autoloader to only autoload classes with the prefix GILL_</p>
<p>function __autoload($class) {</p>
<p>	//only autoload classes containing GILL_<br />
    if(stristr($class, &#8216;GILL_&#8217;)){<br />
        require_once(PATH_TO_LIBRARIES.&quot;$class.php&quot;);<br />
    }<br />
}</p>
<p>Then I created GILL_MyModel.php in application/libraries containing the following class:</p>
<p>class GILL_MyModel extends Model </p>
<p>Then my models are defined as such:</p>
<p>class Tourmodel extends GILL_MyModel {</p>
<p>class Subareamodel extends GILL_MyModel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gillbates</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-906</link>
		<dc:creator>gillbates</dc:creator>
		<pubDate>Sat, 23 Aug 2008 04:44:06 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-906</guid>
		<description>Bit of a problem with this... it's also trying to autoload Codeigniter's 'Model'. I suspect (and I have read of it somewhere) that the Model class does not start with CI. Maybe I should make my own prefix and only autoload files that begin with my prefix?</description>
		<content:encoded><![CDATA[<p>Bit of a problem with this&#8230; it&#8217;s also trying to autoload Codeigniter&#8217;s &#8216;Model&#8217;. I suspect (and I have read of it somewhere) that the Model class does not start with CI. Maybe I should make my own prefix and only autoload files that begin with my prefix?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gillbates</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-903</link>
		<dc:creator>gillbates</dc:creator>
		<pubDate>Sat, 23 Aug 2008 02:41:19 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-903</guid>
		<description>I wrapped the code in &lt;code&gt; and &lt;/code&gt; tags. That doesn't work, I suppose.

Still had a few snags when I was trying to make it work last night (until they dragged me away from the computer). I'll try to make it work today.</description>
		<content:encoded><![CDATA[<p>I wrapped the code in <code> and </code> tags. That doesn&#8217;t work, I suppose.</p>
<p>Still had a few snags when I was trying to make it work last night (until they dragged me away from the computer). I&#8217;ll try to make it work today.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-896</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 22 Aug 2008 15:01:07 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-896</guid>
		<description>Did you encode that piece of code into HTML entities?

Yes, models should be created/written just as you suggested and then loaded in the standard CI way.</description>
		<content:encoded><![CDATA[<p>Did you encode that piece of code into HTML entities?</p>
<p>Yes, models should be created/written just as you suggested and then loaded in the standard CI way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gillbates</title>
		<link>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-895</link>
		<dc:creator>gillbates</dc:creator>
		<pubDate>Fri, 22 Aug 2008 14:05:27 +0000</pubDate>
		<guid>http://pr0digy.com/codeigniter/model-productivity-methods/#comment-895</guid>
		<description>gah! I keep losing my code. Oh well. As you can probably guess, what I meant to say was I created a class named MyModel that extends Model in MyModel.php. Then Tourmodel extends MyModel. Is this the correct implementation?</description>
		<content:encoded><![CDATA[<p>gah! I keep losing my code. Oh well. As you can probably guess, what I meant to say was I created a class named MyModel that extends Model in MyModel.php. Then Tourmodel extends MyModel. Is this the correct implementation?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
