<?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>WGO &#187; Web Development</title>
	<atom:link href="http://www.wiseguysonly.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wiseguysonly.com</link>
	<description>Tim Roberts CakePHP, MySQL and jQuery Developer</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:22:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>CakePHP 2 &#8211; Hashing passwords before saving.</title>
		<link>http://www.wiseguysonly.com/2012/02/02/cakephp-2-hashing-passwords-before-saving/</link>
		<comments>http://www.wiseguysonly.com/2012/02/02/cakephp-2-hashing-passwords-before-saving/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 17:41:59 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=510</guid>
		<description><![CDATA[A quick gotcha here that leverages CakePHP&#8217;s inbuilt utilities to hash data before you commit it to the database. The beauty of this method is that you can still run all your validation checks and then hash the data between validation and saving. Why is that important? Consider you have a rule that says a [...]]]></description>
			<content:encoded><![CDATA[<p>A quick gotcha here that leverages CakePHP&#8217;s inbuilt utilities to hash data before you commit it to the database.</p>
<p>The beauty of this method is that you can still run all your validation checks and then hash the data between validation and saving. Why is that important? Consider you have a rule that says a password should be no more than 15 characters. When you hash it, it would break the rule and your record would never save. </p>
<p>All you have to do is hash your fields in the beforeSave function of your model like this example from a User Model:</p>
<p><code><br />
        public function beforeSave() {<br />
                App::uses('Utitlity','Security');<br />
                if(!empty($this->data['User']['password'])) {<br />
                        $this->data['User']['password'] = Security::hash($this->data['User']['password']);<br />
                }<br />
                return true;<br />
        }<br />
</code></p>
<p>One import aspect of this is to always return true. If you don&#8217;t your record will NEVER save.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2012/02/02/cakephp-2-hashing-passwords-before-saving/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP Development</title>
		<link>http://www.wiseguysonly.com/2011/07/09/cakephp-development/</link>
		<comments>http://www.wiseguysonly.com/2011/07/09/cakephp-development/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 11:34:40 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=473</guid>
		<description><![CDATA[The new website for my CakePHP development company, Zumo Internet is now live. I&#8217;ve been building with PHP for 10 years, but over the past 2 years all of my projects have been built using CakePHP. I&#8217;ve never looked back as far as stability and speed of development is concerned. So if you are looking [...]]]></description>
			<content:encoded><![CDATA[<p>The new website for my <a title="CakePHP development" href="http://www.zumointernet.com">CakePHP development</a> company, Zumo Internet is now live.</p>
<p>I&#8217;ve been building with PHP for 10 years, but over the past 2 years all of my projects have been built using CakePHP. I&#8217;ve never looked back as far as stability and speed of development is concerned.</p>
<p>So if you are looking for a CakePHP developer, please visit and maybe hire me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2011/07/09/cakephp-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CakePHP without a database</title>
		<link>http://www.wiseguysonly.com/2011/06/17/using-cakephp-without-a-database/</link>
		<comments>http://www.wiseguysonly.com/2011/06/17/using-cakephp-without-a-database/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 10:33:04 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[prototyping]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=434</guid>
		<description><![CDATA[I enjoy CakePHP&#8217;s structure and methods so much that I have started  using it for my non-database driven projects and for prototyping big projects. However, when no database is present CakePHP throws a warning that it can&#8217;t connect to the database. The solution is to create a dummy database connection to convince CakePHP that all [...]]]></description>
			<content:encoded><![CDATA[<p>I enjoy CakePHP&#8217;s structure and methods so much that I have started  using it for my non-database driven projects and for prototyping big projects.</p>
<p>However, when no database is present CakePHP throws a warning that it can&#8217;t connect to the database. The solution is to create a dummy database connection to convince CakePHP that all is ok. And, it&#8217;s as simple as this:</p>
<p>Create a new folder <code>app/models/datasources/dbo</code></p>
<p>Create a new file at <code>app/models/datasources/dbo/dbo_dummy_db.php</code> and add the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>   
    <span style="color: #000000; font-weight: bold;">class</span> DboDummyDb <span style="color: #000000; font-weight: bold;">extends</span> DboSource <span style="color: #009900;">&#123;</span>         
                 <span style="color: #000000; font-weight: bold;">function</span> connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>                
                          <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connected</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
                          <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connected</span><span style="color: #339933;">;</span>
                  <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In your app/config/database.php find the default connection array &#8211; a line that starts <code>$default = array</code><br />
and replace the line for the driver from<br />
<code>'driver' =&gt; 'mysql'</code>,<br />
to<br />
<code>'driver' =&gt; 'dummy_db',</code></li>
<p>And that&#8217;s all there is to using CakePHP without a database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2011/06/17/using-cakephp-without-a-database/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Removing tracked files from git without deleting them</title>
		<link>http://www.wiseguysonly.com/2011/06/13/removing-tracked-files-from-git-without-deleting-them/</link>
		<comments>http://www.wiseguysonly.com/2011/06/13/removing-tracked-files-from-git-without-deleting-them/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 09:01:50 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=426</guid>
		<description><![CDATA[&#8212; DISCLAIMER: someone may tell me where I went wrong shortly after publication &#8212; When I develop CakePHP apps, my local database configiration file is very different from the live one. Therefore, when I am using Git to push my changes to a live environment I want to be sure this file is not pushed. [...]]]></description>
			<content:encoded><![CDATA[<p><em>&#8212; DISCLAIMER: someone may tell me where I went wrong shortly after publication &#8212;</em></p>
<p>When I develop CakePHP apps, my local database configiration file is very different from the live one. Therefore, when I am using Git to push my changes to a live environment I want to be sure this file is not pushed. Fortunately Git  has the ability to let me do this with the .gitignore file. I can specify the following:</p>
<p><code>app/config/database.php</code></p>
<p>One path to file on each line will ignore those files.</p>
<p>However, I recently found myself in the situation where I had already added files I wanted to ignore to my repository. After reading the docs and several forums, the answer seemed to be using the following command:</p>
<p><code>git rm --cached filename</code></p>
<p>I did this, commited my changes, then pushed them live. Horror. The database.php had been removed on my local repo and this was subsequently pushed to the live site which duly collapsed. Fortunately I used Git to quickly revert my changes. I&#8217;ve no idea why the command above didn&#8217;t work for me, but I did find a failsafe way of removing a tracked file without deleting it.</p>
<ol>
<li>make sure the path to file is listed in your .gitignore</li>
<li>copy the file outside of your repo.</li>
<li>do a <code>git rm -rf path/to/file.ext</code></li>
<li>do a git commit to remove the file from the repo</li>
<li>copy the file back from where you placed it in step 2</li>
</ol>
<p>You should be able to change the file now and when running git status it should not show up.</p>
<p>It may seem long winded and a more-than-likely unorthodox to do it this way, but it makes me feel safer.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2011/06/13/removing-tracked-files-from-git-without-deleting-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SEO friendly URL slugs with CakePHP.</title>
		<link>http://www.wiseguysonly.com/2010/09/12/seo-friendly-url-slugs-with-cakephp/</link>
		<comments>http://www.wiseguysonly.com/2010/09/12/seo-friendly-url-slugs-with-cakephp/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 19:58:03 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Information Architecture]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=354</guid>
		<description><![CDATA[The CakePHP framework API is a treasure trove of often undiscovered methods and functionality. Recently I came across the Inflector Class methods and noticed the &#8220;slug&#8221; method close to the bottom of the documentation, which is documented thus: Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, [...]]]></description>
			<content:encoded><![CDATA[<p>The CakePHP framework API is a treasure trove of often undiscovered methods and functionality. Recently I came across the Inflector Class methods and noticed the &#8220;slug&#8221; method close to the bottom of the documentation, which is documented thus:</p>
<blockquote><p>Returns a string with all spaces converted to underscores (by default), accented characters converted to non-accented characters, and non word characters removed.</p></blockquote>
<p><span id="more-354"></span>Slug is the perfect method for generating a search engine friendly URL from any string. For instance in an application I am currently developing there is a categories model with a field called title. This makes a great field to automagically convert to a url part for SEO purposes. Now instead of a URL like <code>/category/browse/1</code> ; I can have something like <code>/category/browse/1/restauraunts-cafes-and-bars</code>.</p>
<p>For my taste of URL structure slug doesn&#8217;t work perfectly out of the box: it uses underscores to seperate words, rather than hypens; and it doesn&#8217;t convert all characters to lower-case. Having said that, a workable solutions is never far away in CakePHP.</p>
<p>The easiest solution for me is to build a reusable method in my /app/controllers/app_controller.php that I can access from any other controller or view. This way I can create a slug on the fly in my view or commit them to my database on create or update. So, let me introduce my hyper-simple private method, toSlug() :</p>
<p><code>function _toSlug($string) {<br />
return low(Inflector::slug($string, '-''));<br />
}<br />
</code><br />
Call this method like this:</p>
<p><code>$this-&gt;_toSlug("Any String or Data You like")</code></p>
<p>Which returns <code>any-string-or-data-you-like</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2010/09/12/seo-friendly-url-slugs-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP Full Text Search</title>
		<link>http://www.wiseguysonly.com/2010/06/20/cakephp-full-text-search/</link>
		<comments>http://www.wiseguysonly.com/2010/06/20/cakephp-full-text-search/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 17:12:02 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Information Architecture]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=346</guid>
		<description><![CDATA[CakePHP&#8217;s database abstraction is just one of the reasons to use this powerful framework for agile web development. However, it is not always obvious how to build complex queries. I recently had to implement a MySQL full text search against a music database that searched on titles, descriptions and tags. Full text search is a [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP&#8217;s database abstraction is just one of the reasons to use this powerful framework for agile web development. However, it is not always obvious how to build complex queries. I recently had to implement a MySQL full text search against a music database that searched on titles, descriptions and tags. Full text search is a quick, and not too dirty way to make a pretty decent search, although it does come with a caveat, as described in the MySQL documentation:</p>
<blockquote><p>Full-text indexes can be used only with <code style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; color: #026789; font-weight: bold; font-family: courier, 'courier new', fixed, monospace; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">MyISAM</code> tables, and can be created only for <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: underline; color: #00759f; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="10.4.1. The CHAR and         VARCHAR Types" href="http://dev.mysql.com/doc/refman/4.1/en/char.html"><code style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; color: #026789; font-weight: bold; font-family: courier, 'courier new', fixed, monospace; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">CHAR</code></a>, <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: underline; color: #00759f; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="10.4.1. The CHAR and         VARCHAR Types" href="http://dev.mysql.com/doc/refman/4.1/en/char.html"><code style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; color: #026789; font-weight: bold; font-family: courier, 'courier new', fixed, monospace; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">VARCHAR</code></a>, or <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: underline; color: #00759f; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" title="10.4.3. The BLOB and         TEXT Types" href="http://dev.mysql.com/doc/refman/4.1/en/blob.html"><code style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; color: #026789; font-weight: bold; font-family: courier, 'courier new', fixed, monospace; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">TEXT</code></a>columns.</p></blockquote>
<p><span id="more-346"></span>It did take a little bit of experimentation to get the syntax for the query correct in CakePHP as the query is a little different from the regular &#8220;<em>SELECT field FROM table WHERE somevalue = somevalue</em>&#8220;.</p>
<p>So, for this example I will use a MyISAM table called pages and search against the title, content and tags fields for the term&#8221; jquery web development&#8221;. You should substitute that term with your dynamically passed value in the code below.</p>
<p>Firstly I built the conditions for my query into a &#8220;params&#8221; array.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">$params['conditions'] = array(</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span> &#8216;MATCH(Track.title,Track.description,Track.tags)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span> AGAINST(&#8220;&#8216; . $kw_list . &#8216;&#8221; IN BOOLEAN MODE)&#8217;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span> );</div>
<blockquote><p>$params= array(&#8216;conditions&#8217; =&gt; array(<br />
&#8216;MATCH(Page.title,Page.description,Page.tags)<br />
AGAINST(&#8220;jquery web development&#8221; )&#8217; ));</p></blockquote>
<p>Finally a call to CakePHP&#8217;s native find method will perform the search:</p>
<blockquote><p>$this-&gt;Page-&gt;find(&#8216;all&#8217;,$params);</p></blockquote>
<p>One last note: MySQL full text search can be powerful when used correctly and a potential bottleneck when poorly implemented. I suggest reading <a href="http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html">the documentation</a> for further information and more advanced usage.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2010/06/20/cakephp-full-text-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Select and Unselect All Checkboxes with jQuery</title>
		<link>http://www.wiseguysonly.com/2010/01/15/select-and-unselect-all-checkboxes-with-jquery/</link>
		<comments>http://www.wiseguysonly.com/2010/01/15/select-and-unselect-all-checkboxes-with-jquery/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 19:01:06 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=308</guid>
		<description><![CDATA[I&#8217;ve been working with jQuery to spice up my interfaces for over 12 months now and figured it&#8217;s time to share some of the little techniques I&#8217;ve developed on the way. The first is something I use quite alot when I am giving users the ability to administer lists of items in bulk. That including [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with jQuery to spice up my interfaces for over 12 months now and figured it&#8217;s time to share some of the little techniques I&#8217;ve developed on the way.</p>
<p>The first is something I use quite alot when I am giving users the ability to administer lists of items in bulk. That including a checkbox that when checked sets the state of all the checkboxes beside a list of items to &#8220;checked&#8221;. Naturally unchecking it will uncheck all checkboxes. I&#8217;m sure you get the picture here&#8217;s the code based on two scenarios depending on your preference. But firstly you need to include the jQuery library in the head of your document (I grab mine straight from Google&#8217;s repository to save my bandwidth):</p>
<p><span id="more-308"></span></p>
<p><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;</code></p>
<p>and then somewhere in your document a controller checkbox that toggles all the others (note the call to toggleChecked when the state of the checkbox changes):</p>
<p><code>&lt;input type="checkbox" onclick="toggleChecked(this.checked)"&gt; Select / Deselect All</code></p>
<p>Now here are  two versions of the toggleChecked function dependent on the semantics of your document. The only real difference is the jQuery selector for your list checkboxes:</p>
<p><strong>1: All checkboxes have a class of  &#8220;checkbox&#8221; (&lt;input type=&#8221;checkbox&#8221; class=&#8221;checkbox&#8221; /&gt;)</strong><br />
<code>function toggleChecked(status) {<br />
$(".checkbox").each( function() {<br />
$(this).attr("checked",status);<br />
})<br />
}</code></p>
<p><strong>2: All the checkboxes are contained within a div with an arbitary id:</strong></p>
<p><code>&lt;div id="checkboxes"&gt;<br />
&lt;input type="checkbox" /&gt;<br />
&lt;input type="checkbox" /&gt;<br />
&lt;input type="checkbox" /&gt;<br />
&lt;/div&gt;</code></p>
<p>In this case the function would look like this:</p>
<p><code>function toggleChecked(status) {<br />
$("#checkboxes input").each( function() {<br />
$(this).attr("checked",status);<br />
})<br />
</code></p>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2010/01/15/select-and-unselect-all-checkboxes-with-jquery/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A workaround for the CakePHP alphaNumeric issue</title>
		<link>http://www.wiseguysonly.com/2009/11/27/a-workaround-for-the-cakephp-alphanumeric-issue/</link>
		<comments>http://www.wiseguysonly.com/2009/11/27/a-workaround-for-the-cakephp-alphanumeric-issue/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 14:50:51 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=278</guid>
		<description><![CDATA[Recently whilst building a CakePHP app on a shiny new server I noticed some unexpected behaviour when using an alphaNumeric rule to validate a model. Whatever I passed into the model returned false. That is to say that even a valid alphanumeric string threw up an exception. (if you haven&#8217;t already dived into CakePHP, you [...]]]></description>
			<content:encoded><![CDATA[<p>Recently whilst building a CakePHP app on a shiny new server I noticed some unexpected behaviour when using an alphaNumeric rule to validate a model. Whatever I passed into the model returned false. That is to say that even a valid alphanumeric string threw up an exception. (if you haven&#8217;t already dived into <a href="http://www.cakephp.org">CakePHP</a>, you should &#8211; it&#8217;s a rapid development framework based on <a title="Model View Controller" href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a>.)</p>
<p>The issue seems to be tied to PHP 5.1.2 and the way regular expressions are handled, however it seems the it may appear in other configurations too. Before I get to a workaround, note I haven&#8217;t levelled the &#8220;bug&#8221; word at either PHP nor CakePHP &#8211; for all I know it could be a difference of opinion on how something should be handled. What I do know is that I would rather harness CakePHP&#8217;s flexibility to create custom model rules than try upgrading my current live server PHP installation.</p>
<p>Here is an example of how you should be able to implement the alphaNumeric rule using validation in CakePHP based on a simpliefied model called &#8220;User&#8221;:<br />
class User extends AppModel</p>
<p>{<br />
<code>var $name = 'User';<br />
var $helpers = array('Form');<br />
var $validate = array(<br />
'username' =&gt; array(<br />
'loginRule-1' =&gt; array(<br />
<em> <strong>'rule' =&gt; 'alphaNumeric',</strong></em><br />
'last' =&gt; true,<br />
'message' =&gt; 'Only letters and numbers allowed'<br />
));<br />
}</code></p>
<p>The rule in bold italics above is the one that doesn&#8217;t always work. However this can be easily rectified with a custom rule built on a regular expression seeking out valid alphanumeric strings.</p>
<p>To achieve this the alphaNumeric rule just needs to be replaced with this:</p>
<p><code><strong><em>"rule" =&gt; array('custom', '/^[a-z0-9]*$/i'),</em></strong></code></p>
<p>Problem solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2009/11/27/a-workaround-for-the-cakephp-alphanumeric-issue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Launch Sports Recruitment International</title>
		<link>http://www.wiseguysonly.com/2009/04/08/new-launch-sports-recruitment-international/</link>
		<comments>http://www.wiseguysonly.com/2009/04/08/new-launch-sports-recruitment-international/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 13:47:29 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Web Design in Spain]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=242</guid>
		<description><![CDATA[The latest project of my fledgling web design company in Spain, Zumo Internet has left the shelves. Sports Recruitment International is a re-tool of an already successful web site for a major recruiter of professionals in the sports and leisure industry. We built the site in co-operation with T-MAX media from Oxford. Our input was [...]]]></description>
			<content:encoded><![CDATA[<p>The latest project of my fledgling <a href="http://www.zumointernet.com">web design company in Spain</a>, Zumo Internet has left the shelves. <a href="http://www.sportsrecruitment.com">Sports Recruitment International</a> is a re-tool of an already successful web site for a major recruiter of professionals in the sports and leisure industry.</p>
<p>We built the site in co-operation with T-MAX media from Oxford. Our input was cutting the new designs into valid XHTML and CSS, building some custom jQuery functionality and programming new features into their content management system. The result is a high-impact site for a major corporate client &#8211; and all just as Zumo Internet turns 1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2009/04/08/new-launch-sports-recruitment-international/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Launch Commercial Roofing and Single Ply Membrane products.</title>
		<link>http://www.wiseguysonly.com/2009/02/26/new-launch-commercial-roofing-and-single-ply-membrane-products/</link>
		<comments>http://www.wiseguysonly.com/2009/02/26/new-launch-commercial-roofing-and-single-ply-membrane-products/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 18:55:06 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Web Design in Spain]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.wiseguysonly.com/?p=227</guid>
		<description><![CDATA[The most recent project from my web design company in Spain, Zumo Internet has been launched. IPS UK Ltd supply commercial roofing products. They supply and arrange contracting for some of the largest roofing projects in the UK as can be seen from their case studies of installed roofing systems. They also specialize in commercial [...]]]></description>
			<content:encoded><![CDATA[<p>The most recent project from my web design company in Spain, <a href="http://www.zumointernet.com">Zumo Internet</a> has been launched. <a href="http://www.ipsukltd.co.uk">IPS UK Ltd supply <strong>commercial roofing products</strong></a>. They supply and arrange contracting for some of the largest roofing projects in the UK as can be seen from their <strong><a href="http://www.ipsukltd.co.uk/case-studies.php">case studies of installed roofing systems</a></strong>.</p>
<p><span id="more-227"></span></p>
<p>They also specialize in commercial and domestic <strong><a href="http://www.ipsukltd.co.uk/green-roofs.php">green roofs</a></strong>.  Green roofs / vegetated roofs or roofs with vegetated spaces &#8211; are a simple, attractive, ecologically beneficial and economically viable solution to many of today&#8217;s environmental issues. They have been adopted extensively in Europe (particularly in Germany) but have not really been taken up to the same extent in this country.</p>
<p>Zumo Internet designed and developed a content managed site for them as well as building intranet so they can manage their <strong>commercial roofing projects</strong> and keep a track on clients and warranties for roofing systems provided by them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wiseguysonly.com/2009/02/26/new-launch-commercial-roofing-and-single-ply-membrane-products/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

