<?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>shepherdweb.com &#187; Frameworks</title>
	<atom:link href="http://shepherdweb.com/category/frameworks/feed/" rel="self" type="application/rss+xml" />
	<link>http://shepherdweb.com</link>
	<description>Shane Shepherd: web design and development; music</description>
	<lastBuildDate>Wed, 11 Nov 2009 01:46:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Undefined index: action in /cake/dispatcher.php line 144</title>
		<link>http://shepherdweb.com/2007/04/02/undefined-index-action-in-cakedispatcherphp-line-144/</link>
		<comments>http://shepherdweb.com/2007/04/02/undefined-index-action-in-cakedispatcherphp-line-144/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 02:32:07 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2007/04/02/undefined-index-action-in-cakedispatcherphp-line-144/</guid>
		<description><![CDATA[It took me almost an hour to figure out what was causing this error.
Undefined index: action in /cake/dispatcher.php line 144


The problem turned out to be that one of the values in $property["Listing"] was returning a value which included a space.  Something like this: &#8220;396 &#8220;.  Since the requestAction method uses a URL to [...]]]></description>
			<content:encoded><![CDATA[<p>It took me almost an hour to figure out what was causing this error.</p>
<blockquote><p>Undefined index: action in /cake/dispatcher.php line 144</p>
</blockquote>
<p><code class="block"><?php<br />
$aInfo = $this->requestAction('/tours/GetAgentInfo/' . $property["Listing"]["agent"] . '/' . $property["Listing"]["listingoffice"]);<br />
?></code></p>
<p>The problem turned out to be that one of the values in <code>$property["Listing"]</code> was returning a value which included a <kbd>space</kbd>.  Something like this: &#8220;396 &#8220;.  Since the <code>requestAction</code> method uses a URL to get it&#8217;s parameters, it was bombing when the URL looked like this: &#8216;/tours/GetAgentInfo/396 /94&#8242;.  I used the php <code>trim()</code> function to remove spaces, and presto&hellip; problem solved!</p>
<p><code class="block"><?php<br />
$aInfo = $this->requestAction('/tours/GetAgentInfo/' . trim($property["Listing"]["agent"]) . '/' . trim($property["Listing"]["listingoffice"]));<br />
?></code></p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/CakePHP" rel="tag">CakePHP</a>, <a href="http://technorati.com/tag/PHP" rel="tag"> PHP</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2007/04/02/undefined-index-action-in-cakedispatcherphp-line-144/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using the CakePHP selectTag HtmlHelper</title>
		<link>http://shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/</link>
		<comments>http://shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 04:46:18 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/</guid>
		<description><![CDATA[The use of the selectTag HtmlHelper seems to be confusing to a lot of people (judging from the popularity of questions about it in the CakePHP Google Group).  Hopefully I can clear up a few things about it.
Parameters
selectTag ($fieldName, $optionElements, $selected=null, $selectAttr=array(), $optionAttr=null, $showEmpty=true, $return=false)
$fieldName will typically be the name of your model in [...]]]></description>
			<content:encoded><![CDATA[<p>The use of the <a href="http://api.cakephp.org/class_html_helper.html#dc661e84e1710023d94691fad33f40ec">selectTag</a> <a href="http://api.cakephp.org/class_html_helper.html">HtmlHelper</a> seems to be confusing to a lot of people (judging from the <a href="http://groups-beta.google.com/group/cake-php/search?group=cake-php&#038;q=selectTag&#038;qt_g=Search+this+group">popularity</a> of questions about it in the <a href="http://groups-beta.google.com/group/cake-php">CakePHP Google Group</a>).  Hopefully I can clear up a few things about it.</p>
<h2>Parameters</h2>
<p>selectTag ($fieldName, $optionElements, $selected=null, $selectAttr=array(), $optionAttr=null, $showEmpty=true, $return=false)</p>
<p><code>$fieldName</code> will typically be the name of your model in the singular slash (&#8216;/&#8217;) the primary key: <code>'Post/post_id'</code>.</p>
<p><code>$optionElements</code> is an array of &#8216;value&#8217; =>&#8217;text&#8217; pairs.  The <a href="http://api.cakephp.org/class_model.html#e8844b859626edc554946480046e395f">generateList</a> method is very useful for creating this array.</p>
<p><code>$selected</code> defaults to null and can be used to set the selected option.</p>
<p><code>$selectAttr</code> is an array. It is used to define HTML attributes for the opening <code>select</code> element: <code>array('onclick' => 'myfunction();', 'class' => 'cssclassname')</code></p>
<p><code>$optionAttr </code> serves the same purpose that <code>$selectAttr</code> does, except it applies to the <code>option</code> elements.</p>
<p><code>$showEmpty</code> is used to set whether or not the list has an empty option at the top.  The default is true.  If changed to false, the first <code>option</code> element will be the first value/text pair in your <code>$optionElements</code> array.</p>
<p><code>$return</code> default is false and it defines whether or not this method should return a value.  I don&#8217;t know of any reason why this would ever be set to true.  If someone knows of a scenario where this is useful, please share!</p>
<h2>Application</h2>
<p>Like other HtmlHelpers, the selectTag can be used in a View within the CakePHP MVC framework including Layouts and Helpers.  Typically you would load some data to an array in a <code>'value' =>'text'</code> pair arrangement before calling the selectTag method (example 1).  However, the array can be built &#8220;on the fly&#8221; as well (example 2).</p>
<h5>Example 1</h5>
<p><code class="block"><br />
&lt;?php $agentArray = $this-&gt;requestAction('/agents/select'); ?&gt;<br />
&lt;?=$html-&gt;selectTag('Agent/agent_id', $agentArray, null, array(), null, true, false);?&gt;<br />
</code></p>
<h5>Example 2</h5>
<p><code class="block"><br />
&lt;?=$html-&gt;selectTag('Listing/price',<br />
					array(<br />
						'0' =&gt; 'no min',<br />
						'50000' =&gt; '50,000',<br />
						'100000' =&gt; '100,000',<br />
						'125000' =&gt; '125,000',<br />
						'150000' =&gt; '150,000',<br />
						'175000' =&gt; '175,000',<br />
						'200000' =&gt; '200,000'), '0', array(), null, false, false); ?&gt;<br />
</code></p>
<p>This is by no means comprehensive, but hopefully useful.  The <a href="">CakePHP Google Group</a> and <a href="http://irc.cakephp.org/irc.html">CakePHP IRC Channel</a> are super when trying to wrap you head around something new.</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/CakePHP" rel="tag">CakePHP</a>, <a href="http://technorati.com/tag/selectTag" rel="tag"> selectTag</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2007/01/07/using-the-cakephp-selecttag-htmlhelper/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Editing hasAndBelongsToMany (HABTM) Relationships in CakePHP</title>
		<link>http://shepherdweb.com/2006/08/21/editing-hasandbelongstomany-habtm-relationships-in-cakephp/</link>
		<comments>http://shepherdweb.com/2006/08/21/editing-hasandbelongstomany-habtm-relationships-in-cakephp/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 02:47:16 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2006/08/21/editing-hasandbelongstomany-habtm-relationships-in-cakephp/</guid>
		<description><![CDATA[I had a difficult time wrapping my head around how to do this.  The manual is not much help.  I did get a few clues from a couple of Wiki articles, but in the end I had to piece all this together with stuff I dug out of the CakePHP Google Group.
Let&#8217;s assume [...]]]></description>
			<content:encoded><![CDATA[<p>I had a difficult time wrapping my head around how to do this.  The <a href="http://manual.cakephp.org/">manual</a> is not much help.  I did get a few clues from a couple of <a href="http://wiki.cakephp.org/docs:understanding_associations">Wiki</a> <a href="http://wiki.cakephp.org/docs:method:read">articles</a>, but in the end I had to piece all this together with stuff I dug out of the <a href="http://groups.google.com/group/cake-php">CakePHP Google Group</a>.</p>
<p>Let&#8217;s assume we have two tables, colors and products.  Our model states that products <code>hasAndBelongsToMany</code> colors.  Also, colors <code>hasAndBelongsToMany</code> products.  </p>
<p>Add the following code to app_controller.php:<br />
<code class="block"><br />
	function getSelectedItems($data)<br />
	{<br />
		$return = array();<br />
        foreach ($data as $row)<br />
        {<br />
            $return[$row['id']] = $row['name'];<br />
        }<br />
        return $return;<br />
	}<br />
</code></p>
<p>Our edit function in the products_controller.php will look something like this:<br />
<code class="block"><br />
	function admin_edit($id = null)<br />
	{<br />
		if (empty($this->data))<br />
		{<br />
			$this->set('colors', $this->requestAction('/colors/select'));<br />
// get data for colors DropDownList<br />
$this->Product->id = $id;<br />
$this->data = $this->Product->read();<br />
$this->set('selected_colors', $this->getSelectedItems($this->data['Color']));<br />
		}<br />
		else<br />
		{<br />
		if ($this->Product->save($this->data))<br />
		{<br />
		$this->flash("Your product has been updated.", '/admin/products');<br />
			}<br />
			else<br />
			{<br />
				$this->flash("Unable to update your product.", '/admin/products');<br />
			}<br />
		}<br />
	}<br />
</code></p>
<p>And finally, the code for the multi-select:<br />
<code class="block"><br />
<?=$html->selectTag("Color/Color", $colors, $selected_colors, array('multiple' => 'multiple'))?><br />
</code></p>
<p>If the associations are set up correctly, Cake will automagically save the updated colors when <code>$this->Product->save($this->data)</code> is called in the products controller.  I hope this is helpful to someone, I spent a lot of time digging it up!</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/cakephp" rel="tag">cakephp</a>, <a href="http://technorati.com/tag/HATBM" rel="tag"> HATBM</a>, <a href="http://technorati.com/tag/hasAndBelongsToMany" rel="tag"> hasAndBelongsToMany</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2006/08/21/editing-hasandbelongstomany-habtm-relationships-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>CakePHP Shopping Cart</title>
		<link>http://shepherdweb.com/2006/07/26/cakephp-shopping-cart/</link>
		<comments>http://shepherdweb.com/2006/07/26/cakephp-shopping-cart/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 04:35:55 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2006/07/26/cakephp-shopping-cart/</guid>
		<description><![CDATA[Looking for a standards compliant, open source, php shopping cart built on the popular MVC CakePHP framework?  Checkout BakeSale.
Technorati Tags: CakePHP,  BakeSale,  ecommerce,  shoppingcart
]]></description>
			<content:encoded><![CDATA[<p>Looking for a standards compliant, open source, php shopping cart built on the popular MVC CakePHP framework?  Checkout <a href="http://bakesale.jeepen.net/">BakeSale</a>.</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/CakePHP" rel="tag">CakePHP</a>, <a href="http://technorati.com/tag/BakeSale" rel="tag"> BakeSale</a>, <a href="http://technorati.com/tag/ecommerce" rel="tag"> ecommerce</a>, <a href="http://technorati.com/tag/shoppingcart" rel="tag"> shoppingcart</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2006/07/26/cakephp-shopping-cart/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python meets .NET</title>
		<link>http://shepherdweb.com/2006/07/17/python-meets-net/</link>
		<comments>http://shepherdweb.com/2006/07/17/python-meets-net/#comments</comments>
		<pubDate>Mon, 17 Jul 2006 23:22:29 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2006/07/17/python-meets-net/</guid>
		<description><![CDATA[Article:  A First Look at IronPython: Where Python meets .NET
Download: IronPython 1.0 Beta 8
I&#8217;m don&#8217;t know Python.  However, the more I hear I about it, the more I think I may need to look into it.  Python developers seem to be very passionate their chosen language.  I mean, I like php&#8230;and [...]]]></description>
			<content:encoded><![CDATA[<p>Article: <a title="DevSource.com article" href="http://www.devsource.com/article2/0,1759,1989490,00.asp?kc=DSRSS04029TX1K0000651"> A First Look at IronPython: Where Python meets .NET</a></p>
<p>Download: <a title="download IronPython 1.0 Beta 8" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=fa3f9cc7-2a0d-41d3-ae51-0aef8dfa7c57&#038;DisplayLang=en">IronPython 1.0 Beta 8</a></p>
<p>I&#8217;m don&#8217;t know Python.  However, the more I hear I about it, the more I think I may need to look into it.  Python developers seem to be very passionate their chosen language.  I mean, I like php&#8230;and I like C#&#8230;but when it&#8217;s all said and done, they&#8217;re just a means to an end.  They help me accomplish a task in the most painfree way I know of.  Perhaps if I knew Python it would be even less painful&#8230;maybe even feel good!</p>
<p>At any rate, if Python is as cool as advertised..IronPython has got great.  But, can it compete with the likes of the recently very popular open source Python framework <a href="http://www.djangoproject.com/">Django</a>?  It is Microsoft&#8230;and they seem to have a knack for competition.  Even their bombs have a way of taking over the world and making lots of money.</p>
<p><ins datetime="20060720-7:30am"><b>more information:</b> <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython">IronPython Project Homepage</a>; IronPython 1.0 Beta 9 is now available.</ins></p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/IronPython" rel="tag">IronPython</a>, <a href="http://technorati.com/tag/python" rel="tag"> python</a>, <a href="http://technorati.com/tag/django" rel="tag"> django</a>, <a href="http://technorati.com/tag/frameworks" rel="tag"> frameworks</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2006/07/17/python-meets-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Framework Performance Comparison</title>
		<link>http://shepherdweb.com/2006/07/14/framework-performance-comparison/</link>
		<comments>http://shepherdweb.com/2006/07/14/framework-performance-comparison/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 04:06:26 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2006/07/14/framework-performance-comparison/</guid>
		<description><![CDATA[Stress tests were performed on three MVC frameworks, Symfony on PHP, Rails on Ruby and Django on Python.  Results have been published on the RoR Wiki.  I would be interested in seeing the results of the same tests run with CakePHP.Technorati Tags: frameworks,  symfony,  rails,  django,  cakephp,  mvc
]]></description>
			<content:encoded><![CDATA[<p>Stress tests were performed on three MVC frameworks, <a href="http://www.symfony-project.com/">Symfony</a> on PHP, <a href="http://rubyonrails.org/">Rails</a> on Ruby and <a href="http://www.djangoproject.com/">Django</a> on Python.  <a href="http://wiki.rubyonrails.com/rails/pages/Framework+Performance">Results</a> have been published on the RoR Wiki.  I would be interested in seeing the results of the same tests run with <a href="http://cakephp.org/">CakePHP</a>.<br /><div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/frameworks" rel="tag">frameworks</a>, <a href="http://technorati.com/tag/symfony" rel="tag"> symfony</a>, <a href="http://technorati.com/tag/rails" rel="tag"> rails</a>, <a href="http://technorati.com/tag/django" rel="tag"> django</a>, <a href="http://technorati.com/tag/cakephp" rel="tag"> cakephp</a>, <a href="http://technorati.com/tag/mvc" rel="tag"> mvc</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2006/07/14/framework-performance-comparison/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Single User Admin Area Authentication with CakePHP</title>
		<link>http://shepherdweb.com/2006/07/14/single-user-admin-area-authentication-with-cakephp/</link>
		<comments>http://shepherdweb.com/2006/07/14/single-user-admin-area-authentication-with-cakephp/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 02:52:39 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.shepherdweb.com/2006/07/14/single-user-admin-area-authentication-with-cakephp/</guid>
		<description><![CDATA[This script is mostly the work of Shunro Dozono with some tweaks of my own to make it work with a path to /admin.  It handles simple administrator authentication for a single user.  Ok, here it goes&#8230;
Pre-requisite: CakePHP
First,  download Shuro&#8217;s component, sd_auth.  Copy and paste the code into a file called [...]]]></description>
			<content:encoded><![CDATA[<p>This script is mostly the work of <a href="http://cakephp.seesaa.net/">Shunro Dozono</a> with some tweaks of my own to make it work with a path to /admin.  It handles simple administrator authentication for a single user.  Ok, here it goes&#8230;</p>
<p>Pre-requisite: CakePHP</p>
<p>First,  download Shuro&#8217;s component, <a href="http://cakeforge.org/snippet/detail.php?type=snippet&#038;id=92">sd_auth</a>.  Copy and paste the code into a file called sd_auth.php and put it inside app/controllers/components.</p>
<p>Now, create app_controller.php in app/ and paste the code below:</p>
<p><code class="block"> class AppController extends Controller<br />
{<br />
var $components = array('SdAuth');<br />
function adminAuth()<br />
{<br />
// Auth Check.<br />
if($this->SdAuth->isloggedin() == FALSE)<br />
{<br />
$this->layout = "admin_login";<br />
} else {<br />
$this->layout = "admin";<br />
}<br />
}<br />
}</code></p>
<p>Next, uncomment the following line in app/config/core.php:</p>
<p><code class="block">define('CAKE_ADMIN', 'admin');</code></p>
<p>Now, if you pre-pend a function in any of your controllers with &#8220;admin_&#8221; (eg: admin_add) it will now be accessed via the path /admin/add.  Insert the authentication call at the beginning of each one of those functions:</p>
<p><code class="block">function admin_add()<br />
{<br />
$this->adminAuth();<br />
}</code></p>
<p>&#8230;and that method will be authenticated before continuing! Thanks for the tip Shunro.</p>
<div class="techtags"><p>Technorati Tags: <a href="http://technorati.com/tag/cakephp" rel="tag">cakephp</a>, <a href="http://technorati.com/tag/authentication" rel="tag"> authentication</a>, <a href="http://technorati.com/tag/php" rel="tag"> php</a></p></div>
]]></content:encoded>
			<wfw:commentRss>http://shepherdweb.com/2006/07/14/single-user-admin-area-authentication-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
