<?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>Aaron Jefferson Villanueva&#039;s Blog Site&#187; CakePHP</title>
	<atom:link href="http://malebolgia.shadowsonawall.net/tag/cakephp/feed" rel="self" type="application/rss+xml" />
	<link>http://malebolgia.shadowsonawall.net</link>
	<description>Programming / Designing Blogging from windows to mac.</description>
	<lastBuildDate>Sun, 06 May 2012 20:03:01 +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>Cake using Multiple Select Checkboxes</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/cake-using-multiple-select-checkboxes.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/cake-using-multiple-select-checkboxes.html#comments</comments>
		<pubDate>Thu, 03 Dec 2009 02:26:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[explode function]]></category>
		<category><![CDATA[form helper]]></category>
		<category><![CDATA[implode function]]></category>
		<category><![CDATA[multiple select checkboxes]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=150</guid>
		<description><![CDATA[A sample on how to use multiple select checkbox within cakephp views and controller.
&#160;

After reviewing the http://api.cakephp.org/file/cake/libs/view/helpers/form.php#method-FormHelperselect 
1.) Inserting to database
-View Decleration Example.


1
2
3
4
5
6
7
8
9
10
11
 &#60;?php 
//add.ctp for example
?&#62;
     &#60;em&#62;How would you describe your job (mark as many as applies):   &#60;/em&#62;
           [...]]]></description>
			<content:encoded><![CDATA[<p>A sample on how to use <span style="color: #333300;"><strong>multiple select checkbox</strong></span> within cakephp views and controller.</p>
<p>&nbsp;</p>

<p>After reviewing the <strong><a href="http://api.cakephp.org/file/cake/libs/view/helpers/form.php#method-FormHelperselect" target = "_blank">http://api.cakephp.org/file/cake/libs/view/helpers/form.php#method-FormHelperselect</a></strong></p> <br />
<p><strong><span style="color: #993300;">1.) Inserting to database</span></strong></p>
<p>-View Decleration Example.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</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: #666666; font-style: italic;">//add.ctp for example</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
     &lt;em&gt;How would you describe your job (mark as many as applies):   &lt;/em&gt;
           <span style="color: #000000; font-weight: bold;">&lt;?php</span>       <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'describeJob'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'div'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'select'</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'multiple'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'legend'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'false'</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Physical'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Physical'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Mental'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Mental'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Stressful'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Stressful'</span><span style="color: #339933;">,</span>  <span style="color: #0000ff;">'Easy-going'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Easy-going'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Secure'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Secure'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Non-secure'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Non-secure'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Exhausting'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Exhausting'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Relaxing'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Relaxing'</span> <span style="color: #009900;">&#41;</span>
                                                      <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>




<p>-On your controller. Use implode php function and add a seperator that you like, for this example I use ","</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</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: #666666; font-style: italic;">//job_controller @add() function</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#41;</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;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Job'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'describeJob'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Job'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'describeJob'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Job</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>



<p><br /> <span style="color: #993300;"><strong>2.) Editing part, Retrieving values of the datafield to mark check on those were choosen before.  <br /><span style="color: #D83E1C;"> -View Decleration Example. In this example I used explode function of php directly in the view, notice the <span style="color: #4B692D;"> <em>"selected"</em> </span> option added in to the $form-&gt;input helper, this will get the values, supposed to be check in that field.</span></strong></span></p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #666666; font-style: italic;">//edit.ctp for example</span>
       <span style="color: #000088;">$piecesJob</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Job'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'describeJob'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'describeJob'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'div'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'select'</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'multiple'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'legend'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'false'</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Physical'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Physical'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Mental'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Mental'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Stressful'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Stressful'</span><span style="color: #339933;">,</span>  <span style="color: #0000ff;">'Easy-going'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Easy-going'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Secure'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Secure'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Non-secure'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Non-secure'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Exhausting'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Exhausting'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Relaxing'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Relaxing'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                                                    <span style="color: #0000ff;">'selected'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$piecesJob</span>   <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>



<p><strong>That's it</strong> <img src='http://malebolgia.shadowsonawall.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/cake-using-multiple-select-checkboxes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cake Baking Models &#8211; Cannot see other tables</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/cake-baking-models-cannot-see-other-tables.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/cake-baking-models-cannot-see-other-tables.html#comments</comments>
		<pubDate>Sun, 08 Nov 2009 02:57:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[tabke]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=131</guid>
		<description><![CDATA[
Problem.After I updated the database, I added 1 table; relate it to another table, and go to the command line to bake what I did, after typing "cake bake model" at the command prompt, I found out that the recently added table was not listed.

&#160;
Reason.Cake caches your model schema. Solution.1.) Clear your cache by deleting all files [...]]]></description>
			<content:encoded><![CDATA[
<p><strong><span style="color: #ff0000;">Problem.</span></strong><br />After I updated the database, I added 1 table; relate it to another table, and go to the command line to bake what I did, after typing "<span style="color: #993300;"><em>cake bake model</em></span>" at the command prompt, I found out that the recently added table was not listed.</p>
<p><a href="http://malebolgia.shadowsonawall.net/wp-content/uploads/2009/11/cake-table-large.jpg"><img class="size-full wp-image-130" title="Cake PHP Bake Model Problem" src="http://malebolgia.shadowsonawall.net/wp-content/uploads/2009/11/cake-table-smal.jpg" alt="Cake PHP Bake Model Problem" width="200" height="101" /></a></p>
<p>&nbsp;</p>
<p><strong><span style="color: #800000;">Reason.</span></strong><br />Cake caches your model schema. <br /><br /><strong><span style="color: #99cc00;">Solution.</span></strong><br />1.) <br />Clear your cache by deleting all files in your app's <strong><span style="color: #333300;"><span style="text-decoration: underline;">tmp/cache/models/</span></span></strong> <br /><span style="color: #333300;"><strong><span style="text-decoration: underline;">and tmp/cache/persistent/</span></strong></span><br /><br />2.) <br />Disable caching in your app's config/core.php // make sure to enable back again in production setup</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Turn off all caching application-wide.  *  
 */</span>  
Configure<span style="color: #339933;">::</span><span style="color: #004000;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Cache.disable'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>



<p>After doing the solution, I can now successfully bake the new table.</p>
]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/cake-baking-models-cannot-see-other-tables.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

