<?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>Promet CakePHP Source</title>
	
	<link>http://cakephp.prometsupport.com</link>
	<description />
	<lastBuildDate>Mon, 23 Feb 2009 08:03:07 +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/PrometCakephpSource" type="application/rss+xml" /><item>
		<title>PHPUGPH Roadshow and CakePHP</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/WJ4naY4en_8/</link>
		<comments>http://cakephp.prometsupport.com/2009/phpugph-roadshow-and-cakephp/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 08:03:07 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/?p=160</guid>
		<description><![CDATA[Last January 24 and 31, I had the honor to finally meet and work with the PHPUGPH Roadshow team. I involuntarily volunteer (just joking Chean  ) to present CakePHP Introduction for students of Centro Escolar University and University of the Philippines (Diliman). It was a very nice and fun experience to be working with [...]]]></description>
			<content:encoded><![CDATA[Last January 24 and 31, I had the honor to finally meet and work with the <a rel="nofollow" href="http://technogra.ph/20090206/sections/events/php-user-group-philippines-wants-to-spread-the-love/">PHPUGPH Roadshow</a> team. I involuntarily volunteer (just joking Chean <img src='http://cakephp.prometsupport.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ) to present CakePHP Introduction for students of Centro Escolar University and University of the Philippines (Diliman). It was a very nice and fun experience to be working with Jeff, Chean, Ridvan, Paul, Francis, Jhayson, JrYap, Eric and the school representatives. Here are some pictures for the 2 events.<br /><br /><strong>CEU Leg</strong><br /><embed src="http://images.multiply.com/multiply/slide-show.swf" type="application/x-shockwave-flash" width="500" height="500" quality="high" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" FLASHVARS="album_id=jseracar:photos:21&#038;security=vYn3yxNPIfhITPd9lRNXag&#038;base_uri=multiply.com"><br /><br /><strong>UPD Leg</strong><br /><embed src="http://images.multiply.com/multiply/slide-show.swf" type="application/x-shockwave-flash" width="500" height="500" quality="high" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" FLASHVARS="album_id=jseracar:photos:23&#038;security=3h3uGYh5ki5A0wbJ7huepw&#038;base_uri=multiply.com"><br /><br />I hope the students learned just a little though. There might more to come if budget permits! haha! The roadshow is accepting sponsors and volunteer speakers so don&#8217;t be shy to contact PHPUGPH or Jeffrey Seracarpio at jseracar@phpugph.com if you are willing to help this advocacy. For schools, you can also contact Sir Jeff.]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2009/phpugph-roadshow-and-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2009/phpugph-roadshow-and-cakephp/</feedburner:origLink></item>
		<item>
		<title>INI Based Permission Component</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/oVx9MytkaXE/</link>
		<comments>http://cakephp.prometsupport.com/2009/ini-based-permission-component/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 13:37:42 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[Behaviors]]></category>
		<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[cakePHP websites]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/?p=142</guid>
		<description><![CDATA[Yet another permission component was created this week but this time, it&#8217;s simplier and written in a text file. In one of our project, one of the follow-up requirement was to allow users of certain groups upgrade into a better status. The project was already in production and I was using ACL with Auth component [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another permission component was created this week but this time, it&#8217;s simplier and written in a text file. In one of our project, one of the follow-up requirement was to allow users of certain groups upgrade into a better status. The project was already in production and I was using ACL with Auth component to do my authentication. Unfortunately, this is one of <a href="http://www.mail-archive.com/cake-php@googlegroups.com/msg57645.html">ACLs weakness</a>. </p>
<blockquote><p>Changing a users group does not change the ARO parent (effectively making it useless/impossible to change groups). I tried fixing this home-brew style, but since there&#8217;s no setParent in 1.2&#8217;s db_acl, it&#8217;s far harder than it should be.</p></blockquote><p>That was reported back in 2007 and there was still no solution found in the net. It is also not an option for me to go through the above suggestion in fixing the problem so the the other solution is to find another one or create one. I chose the latter.</p>

<p><strong>Why create a new one?</strong></p><p>The other solutions that I found still needs some configuration in the controllers. Since I already have a ton of files, I don&#8217;t want to go through all of them to add a line or two. I need ACLs way of doing it all in the background. Also, I am already using Auth component and I want to keep it.</p><p><strong>Why did I choose a text file over a database?</strong></p><p>My intention is to make the application faster since load time is really getting slower. Since the application isn&#8217;t that big, I only have less than 200 lines for the permissions, so a database is just overkill. Even if I use a database, I might cache it anyway so it saves me extra query.</p>

<p><strong>The component</strong></p><p>So Permission Component was created. Below is the instruction on how to install it.</p><ol>
<li><a href='http://cakephp.prometsupport.com/wp-content/uploads/2009/01/permissionphp.txt'>Download this component</a> and copy to your components folder. </li><li>Create cake_dir/app/config/permissions.ini</li>
</ol><p>The content for permissions.ini is as follows</p>
<pre class="devcodeblock" title="INI"><input type="hidden" value="lines"><pre class="devcode">
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>ControllerName<span style="">&#93;</span></span>
<span style="color: #000099;">actionName</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> group_id,group_id</span>
 
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>PluginName.ControllerName<span style="">&#93;</span></span>
<span style="color: #000099;">actionName</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> group_id,group_id</span>
</pre></pre>

<p>The <em>ControllerName</em> should be the controller name itself (in camel-case format).</p><p>The <em>actionName</em> is also the action name itself (in camel-case format).</p><p>The <em>PluginName</em> is the plugin name itself (in camel-case format).</p><p>The <em>group_id</em> is the one written in your Auth component. Your Auth component should have a group_id value because this is what our Permission component will look for. It could be a number or set of characters.</p>

<p>Example:</p>
<pre class="devcodeblock" title="INI"><input type="hidden" value="lines"><pre class="devcode">
<span style="color: #666666; font-style: italic;">; Group ID 1 = Admin</span>
<span style="color: #666666; font-style: italic;">; Group ID 2 = Member</span>
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>Accounts<span style="">&#93;</span></span>
<span style="color: #000099;">index</span> <span style="color: #000066; font-weight:bold;">=</span> 
<span style="color: #000099;">add</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span>
<span style="color: #000099;">edit</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> <span style="">1</span>,2</span>
<span style="color: #000099;">delete</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> <span style="">1</span>,2</span>
 
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>ShoppingCart.Orders<span style="">&#93;</span></span>
<span style="color: #000099;">index</span> <span style="color: #000066; font-weight:bold;">=</span> 
<span style="color: #000099;">report</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span>
</pre></pre><p>Assigning no group id in an actionName will simply ignore it.</p>

<p><strong>Reminder</strong></p><p>Use at your own risk. If you found a bug, please post them at the comment form.</p>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2009/ini-based-permission-component/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2009/ini-based-permission-component/</feedburner:origLink></item>
		<item>
		<title>How to Bake a New Project in CakePhp</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/Pu8tnEWH-BI/</link>
		<comments>http://cakephp.prometsupport.com/2008/learn-how-to-bake-cakephp-app/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 13:35:50 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[bake]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/?p=103</guid>
		<description><![CDATA[<br />div.block {margin: .5em 25px; background-color: #efefef; padding: .5em;}<br />div.note {margin: .5em 25px; background-color: #fffbcc; padding: .5em;}<br />I use bake to start any project of mine and therefore doesn&#8217;t mean that using it produces a complete app unless you only want a CRUD application.This tutorial is intended for beginners in cakephp. It is still recommended that you look [...]]]></description>
			<content:encoded><![CDATA[<style>
div.block {margin: .5em 25px; background-color: #efefef; padding: .5em;}
div.note {margin: .5em 25px; background-color: #fffbcc; padding: .5em;}
</style><br />I use bake to start any project of mine and therefore doesn&#8217;t mean that using it produces a complete app unless you only want a CRUD application.<br /><br />This tutorial is intended for beginners in cakephp. It is still recommended that you look at the <a href="http://book.cakephp.org/view/219/Blog">blog tutorial</a> in cakephp manual because it has a more complete introduction for the framework. <br /><br />Take note that I am using the <a rel="nofollow" href="http://cakeforge.org/frs/?group_id=23&#038;release_id=426">Cakephp 1.2.0.7692 RC3</a> in demonstrating this little project because it is the latest release as of this writing. <br /><br /><h2>What to do and what do we need to begin?</h2>
To start off, we need a project. I opted a mini-library application which consists of<br />
<div class="block">Books<br />Authors<br />Book reviews by users<br /></div>
<span id="more-103"></span><br />The mini-library will store different books. Each books can have one or more authors and one or more reviews created by users. So we will have the following tables<br />
<div class="block">authors<br />books<br />books_authors<br />book_reviews<br />users<br /></div>
<br />And they have the following relationships:<br />
<div class="block">books can have many authors<br />authors can have many books<br />books can have many reviews<br />users can have many reviews<br />a review is owned by a book<br /></div>
<br /><a href='http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cakedemo_1.sql'>Download the SQL</a> and create your database.<br /><br /><h2>Let&#8217;s start baking!</h2>
Since our topic is about baking, we will maximize the use of cake CLI. First, setup your environment so that it will accept the cake command. For Ubuntu users, it is already available in synaptic or use apt-get<br /><br /><pre class="devcodeblock" title="Bash"><input type="hidden" value="lines"><pre class="devcode"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> cakephp1.2-scripts</pre></pre>
<br />For windows users, I used this <a rel="nofollow" href="http://www.webdevelopment2.com/cakephp-bake-baking-models-controllers-views-cakephp-12/">tutorial for setting up Windows</a>.<br />
<div class="note">The following steps is done in Windows so I cannot guarantee the result will be the same in Ubuntu.</div>
<br />Once you have setup your environment, everything is just easy. I do not think I even need to tell you what you need to do but I still will since I already started it:P<br /><br />You just need to remember this steps:
<ol>
<li>Create a project. This creates all the files and directories under the /app directory</li><li>Configure database.php. We will do that using the command line</li><li>Start creating your Models. As the blog tutorial mentioned, models are the bread and butter of cakephp.</li><li>Create your controllers </li><li>Finally, create your views</li><li>Check your new app!</li>
</ol>
<br />So let's start doing something and stop talking eh? <br /><br />Open your command line and go to your www directory or wherever you want to create your cakephp project. Do not yet create folder for this project. So in my case, my web directory is E:\www\. Type <br /><br /><pre class="devcodeblock" title="Bash"><input type="hidden" value="lines"><pre class="devcode">cake bake </pre></pre>
<br />It will ask you to create your project since it cannot find an existing one. <br /><br /><b>Step 1: Create project</b><br />I created <em>mylibrary</em> project. Here is the output.<br /><br /><a href="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake1.png"><img src="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake1-300x181.png" alt="CakePhp bake step 1 - Create Project" title="cake_bake1" width="300" height="181" class="size-medium wp-image-121" /></a><br /><br /><b>Step 2: Configure database</b><br />Then it will ask you to create your database config. In my example, my database name is <em>cakedemo_1</em>.<br /><br /><a href="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake2.png"><img src="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake2-300x247.png" alt="CakePhp bake step 2 - Configure database" title="cake_bake2" width="300" height="247" class="size-medium wp-image-122" /></a><br /><br />And we're done with the installation. If you will check your files, <em>mylibrary</em> folder is created in E:\www. <em>mylibrary</em> already contains all the necessary files and folders to start building your app. To check, go to <u>http://localhost/mylibrary</u>. <br /><br /><a href="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake3.png"><img src="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake3-300x145.png" alt="CakePhp bake step 3 - Installation result" title="cake_bake3" width="300" height="145" class="size-medium wp-image-123" /></a><br /><br />Do we have the same result?<br /><br />There were 3 things that happened here in the background. 
<ul>
<li>In mylibrary/app/config/core.php, the Security.salt was modified</li><li>mylibrary/app/config/database.php was created</li><li>In mylibrary/app/webroot/index.php, CAKE_CORE_INCLUDE_PATH was changed to the absolute path of your cake core library, in my case "E:www\minilib" because this is what I entered in my Path settings (remember this <a rel="nofollow" href="http://www.webdevelopment2.com/cakephp-bake-baking-models-controllers-views-cakephp-12/">tutorial</a>?) So with this, you have a <strong>centralized cakephp core library</strong>.</li>
</ul>
<br />There you have it, a new cakephp project! Let's proceed.<br /><br /><b>Step 3: Create models, controllers and views</b><br />Next step is to create our library application. Again, type <strong>cake bake</strong> in your command line. The <strong>Interactive Bake Shell</strong> will appear to ask for more directions. You must ofcourse create first your models, then controllers and finally views. Afterwards, you should have the following files like mine:<br /><br /><a href="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake4.png"><img src="http://cakephp.prometsupport.com/wp-content/uploads/2008/10/cake_bake4-129x300.png" alt="CakePhp Bake Step 3 - result" title="cake_bake4" width="129" height="300" class="size-medium wp-image-127" /></a><br /><br />If you already have that, congratulations! Your done! <img src='http://cakephp.prometsupport.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Visit the Books page in <u>http://localhost/mylibrary/books/</u> to start adding your data.<br /><br /><strong>More tricks you can try out</strong><br />There are also shortcuts if you only want to create models<br /><pre class="devcodeblock" title="Bash"><input type="hidden" value="lines"><pre class="devcode">cake bake model</pre></pre>
<br />or controllers<br /><pre class="devcodeblock" title="Bash"><input type="hidden" value="lines"><pre class="devcode">cake bake controller</pre></pre>
<br />or views<br /><pre class="devcodeblock" title="Bash"><input type="hidden" value="lines"><pre class="devcode">cake bake view</pre></pre>
<br />For the next post, I'll tackle how to set up different authentication components. Till next time. Happy Baking!]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/learn-how-to-bake-cakephp-app/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/learn-how-to-bake-cakephp-app/</feedburner:origLink></item>
		<item>
		<title>Learn Containable Behavior by Example</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/tMTpbd-hJJU/</link>
		<comments>http://cakephp.prometsupport.com/2008/learn-containable-behavior-by-example/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 07:58:49 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[Associations]]></category>
		<category><![CDATA[Behaviors]]></category>
		<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[containable]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/?p=44</guid>
		<description><![CDATA[In cakephp, adding relationships is easy. We just have to declare the hasOne, belongsTo, hasMany and the famous HABTM relationship to do all the dirty work of joining tables. But declaring them all at once could lead to a slow page.In version 1.1, what we do is utilize the bindModel() and unbindModel(). We do not [...]]]></description>
			<content:encoded><![CDATA[In cakephp, adding relationships is easy. We just have to declare the hasOne, belongsTo, hasMany and the famous HABTM relationship to do all the dirty work of joining tables. But declaring them all at once could lead to a slow page.<br /><br />In version 1.1, what we do is utilize the <a href="http://cakephp.prometsupport.com/2008/binding-ur-models-d-easy-way/">bindModel() and unbindModel()</a>. We do not declare all associations in the Model class yet. This was a good solution. I was looking for this option in version 1.2 and I found the Containable Behavior. Studying containable was a little rough before but there are documents now that are really helpful.<br /><span id="more-44"></span>
<ul><br />	<li><a href="http://book.cakephp.org/view/474/Containable">Cakephp Book: Containable</a></li>
	<li><a href="http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/">CakeBaker: New Core Behavior &#8211; Containable</a></li>
	<li><a href="http://www.studiocanaria.com/articles/cakephp_containable_behavior">StudioCanaria: Cakephp Containable Behavior</a></li>
</ul>
Today, I&#8217;ll be showing you how to use Containable in pagination and in regular find method. You must have a fair understanding of the behavior so I suggest you read the above articles first. If you are ready, follow the instructions below:
<ol><br />	<li>Download the latest 1.2 release of cake. As of this writing, I tested it in cake_1.2.0.7296-rc2. Do the usual cake installation procedures.</li>
	<li><a href="http://cakephp.prometsupport.com/wp-content/uploads/2008/09/containable_by_example.zip">Download this file</a> and unzip. It must contain an &#8220;app&#8221; folder</li>
	<li>Replace the /app from #1 with the /app from #2 but leave the config file of #1.</li>
	<li>Use the /app/class.sql to setup your database</li>
</ol>
The idea of the sample is taken from a virtual school application. So we have Departments, Courses, Classes, Students and Teachers, Students Comments on Class and Students Ratings on Class. The following is an explanation of tables declared in class.sql so you can follow the relationships:
<table style="border-collapse: collapse;" border="1" cellspacing="0" cellpadding="10" width="100%"><br /><tbody>
<tr valign="top">
<th width="20%">TABLE</th><th>RELATIONSHIP</th>
</tr><tr valign="top">
<td>department</td><td>has many courses</td>
</tr><tr valign="top">
<td>courses</td><td>has many classes<br />belongsto departments</td>
</tr><tr valign="top">
<td>classes</td><td>belongs to courses<br />belongs to teacher<br />has many comments<br />has many ratings</td>
</tr><tr valign="top">
<td>teachers</td><td>has many classes</td>
</tr><tr valign="top">
<td>ratings</td><td>belongs to class<br />belongs to student</td>
</tr><tr valign="top">
<td>comments</td><td>belongs to class<br />belongs to student</td>
</tr><tr valign="top">
<td>students</td><td>has many comments<br />has many ratings</td>
</tr>
</tbody></table>
<br /><h2>Exampe1: List of Classes</h2>
What we will do is get only the basic information for the list of classes. Those includes:
<ul><br />	<li>Class title</li>
	<li>Course it belongs to</li>
	<li>Department it belongs to</li>
	<li>Teacher name</li>
</ul>
It will look like this (replace the http://localhost with your local address)<br />http://localhost/cake/my_classes/index<br /><br />Let&#8217;s compare the recursive and containable method.<br /><br /><strong>Using The Recursive Method</strong><br />Check the MyClassesController::unfiltered_result() for your reference. First try is I added the ffg line<br /><pre class="devcodeblock" title="PHP"><input type="hidden" value="lines"><pre class="devcode"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">MyClass</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">recursive</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> </pre></pre>
but the problem is that I could not get the Department name. Then I tried<br /><pre class="devcodeblock" title="PHP"><input type="hidden" value="lines"><pre class="devcode"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">MyClass</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">recursive</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span> </pre></pre>
and there I have all the information I need. The problem is that there are just to many data I do not need. Another option is to use the the paginate fields filter. Try adding this:<br /><pre class="devcodeblock" title="PHP"><input type="hidden" value="lines"><pre class="devcode"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'MyClass'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fields'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Course.title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MyClass.title'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></pre>
<br />The result? Check it for yourself in http://localhost/cake/my_classes/unfiltered_result<br /><br /><strong>Using Containable Behavior</strong><br />If you look at MyClassesController::index2(), you would see the ffg:<br /><pre class="devcodeblock" title="PHP"><input type="hidden" value="lines"><pre class="devcode">
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'MyClass'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'contain'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> 
            <span style="color: #0000ff;">'Teacher'</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'Course'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'Department'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> 
                    <span style="color: #0000ff;">'fields'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> 
                        <span style="color: #0000ff;">'Department.title'</span><span style="color: #339933;">,</span> 
                        <span style="color: #0000ff;">'Department.id'</span> 
                    <span style="color: #009900;">&#41;</span> 
                <span style="color: #009900;">&#41;</span> 
            <span style="color: #009900;">&#41;</span> 
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
</pre></pre>
That basically tells cake to find the Class Teacher and return all fields, the course it belongs to and return all the fields and finally the course' Department title and ID. Now run this http://localhost/cake/my_classes/filtered_result and compare the result with the previous example. It became cleaner isn't it?<br /><br />With Containable, you can specify which tables to include and what fields to include each table. You can also add order and limit filters and also conditions. It took me a while to grasp the format because at first glance it is a bit difficult to follow. I use the following format:<br /><br /><pre class="devcodeblock" title="PHP"><input type="hidden" value="lines"><pre class="devcode">
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Model0</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">contain</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
 <span style="color: #0000ff;">'Model1'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> 
 <span style="color: #0000ff;">'fields'</span> 	 <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'modelField1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'modelField2'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'your condition here'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'order'</span> 	 <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'asc'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'Model2'</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'Model2'</span>
 <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span>
</pre></pre>
<h2>Example2: Class View</h2>
This is just to show you a more complicated containable query. We want to get more information about the class. That includes:
<ul><br />	<li>Class title</li>
	<li>Course it belongs to</li>
	<li>Department it belongs to</li>
	<li>Teacher name</li>
	<li><strong>Student comments that were approved and student name</strong></li>
	<li><strong>Student ratings that were approved and student name</strong></li>
</ul>
We can achieve the desired results using recursive but then again we will be wasting so much process time. In containable, we'll just have to declare what we want.<br /><br /><pre class="devcodeblock" title="PHP"><input type="hidden" value="lines"><pre class="devcode">
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">MyClass</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">contain</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
            <span style="color: #0000ff;">'Teacher'</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'Rating'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'Student'</span><span style="color: #339933;">,</span> 
                <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'created'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'desc'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'approved'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'Comment'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'Student'</span><span style="color: #339933;">,</span> 
                <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'RAND()'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'limit'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">,</span>
                <span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'approved'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
            <span style="color: #0000ff;">'Course'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                <span style="color: #0000ff;">'Department'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                    <span style="color: #0000ff;">'fields'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
                        <span style="color: #0000ff;">'Department.title'</span><span style="color: #339933;">,</span> 
                        <span style="color: #0000ff;">'Department.id'</span> 
                    <span style="color: #009900;">&#41;</span> 
                <span style="color: #009900;">&#41;</span> 
            <span style="color: #009900;">&#41;</span> 
            <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
</pre></pre>
<br />Can you see the format now? Play around with the codes and check their results to get more comfortable with it. Happy Baking!]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/learn-containable-behavior-by-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/learn-containable-behavior-by-example/</feedburner:origLink></item>
		<item>
		<title>Use Model-&gt;create()</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/DkQbd4Lisxw/</link>
		<comments>http://cakephp.prometsupport.com/2008/use-model-create/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 05:35:23 +0000</pubDate>
		<dc:creator>rolan</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/?p=37</guid>
		<description><![CDATA[From now on, I&#8217;ll always use Model-&#62;create() before saving new data.I&#8217;ve been using Model-&#62;create() for a series Model-&#62;save() calls (like in a loop) to initialize the model class for saving new information. But when I only need to do a single call to save(), I no longer call create() assuming that I&#8217;m starting with a [...]]]></description>
			<content:encoded><![CDATA[From now on, I&#8217;ll always use Model-&gt;create() before saving new data.<br /><br />I&#8217;ve been using Model-&gt;create() for a series Model-&gt;save() calls (like in a loop) to initialize the model class for saving new information. But when I only need to do a single call to save(), I no longer call create() assuming that I&#8217;m starting with a new set of information. I was always able to get away with it until I had this bug that annoyed me for a few hours.<br /><br />Long story short, I learned something: not only when doing multiple calls to <em>Model-&gt;save()</em>, you should also call <em>Model-&gt;create()</em> before saving if a previous call to <em>Model-&gt;read()</em> was made. Or better yet, <strong>always call Model-&gt;create() whenever you are about to save new data</strong>. There are cases the previous calls to save and read made are not that obvious, like in the beforeFilter() callbacks of the controller (or the parent::beforeFilter(), like in my case).]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/use-model-create/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/use-model-create/</feedburner:origLink></item>
		<item>
		<title>jQuery star rating problem with brackets []</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/4r9GaN5DhX4/</link>
		<comments>http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 10:54:23 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[bug fixes]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[star rating]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/</guid>
		<description><![CDATA[If you used the star rating plugin of jQuery in cakePHP, you might experienced that the hover effects are not working properly. This is because one of the class name used to identify the buttons uses the radio button name. This will be a problem in cakephp because we use brackets in names.<br />&#60;input type=&#34;radio&#34; name=&#34;data[Model][field]&#34; [...]]]></description>
			<content:encoded><![CDATA[If you used the <a href="http://plugins.jquery.com/project/MultipleFriendlyStarRating">star rating plugin of jQuery</a> in cakePHP, you might experienced that the hover effects are not working properly. This is because one of the class name used to identify the buttons uses the radio button name. This will be a problem in cakephp because we use brackets in names.<br /><br /><pre class="devcodeblock" title="HTML"><input type="hidden" value="lines"><pre class="devcode">
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;radio&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;data[Model][field]&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;star&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
</pre></pre>
<br />In order to fix that, we need to remove them. Here is quick fix. Open file <pre>jquery.rating.js</pre>:<br /><br />from (line 97):<br /><pre class="devcodeblock" title="Javascript"><input type="hidden" value="lines"><pre class="devcode">
<span style="color: #006600; font-style: italic;">// grouping:</span>
  <span style="color: #003366; font-weight: bold;">var</span> n <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span><span style="color: #339933;">;</span>
</pre></pre>
<br />to:<br /><pre class="devcodeblock" title="Javascript"><input type="hidden" value="lines"><pre class="devcode">
<span style="color: #006600; font-style: italic;">// grouping:</span>
  <span style="color: #003366; font-weight: bold;">var</span> real_name <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> n <span style="color: #339933;">=</span> real_name.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^A-Za-z0-9_\-]/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// remove unwanted characters</span>
</pre></pre>
<br />from (line 108):<br /><pre class="devcodeblock" title="Javascript"><input type="hidden" value="lines"><pre class="devcode">
$.<span style="color: #660066;">rating</span>.<span style="color: #660066;">groups</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">valueElem</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;input type=&quot;hidden&quot; name=&quot;'</span> <span style="color: #339933;">+</span> n <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; value=&quot;&quot;'</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>settings.<span style="color: #660066;">readOnly</span> <span style="color: #339933;">?</span> <span style="color: #3366CC;">' disabled=&quot;disabled&quot;'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
</pre></pre>
<br />to:<br /><pre class="devcodeblock" title="Javascript"><input type="hidden" value="lines"><pre class="devcode">
$.<span style="color: #660066;">rating</span>.<span style="color: #660066;">groups</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">valueElem</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;input type=&quot;hidden&quot; name=&quot;'</span> <span style="color: #339933;">+</span> real_name <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; value=&quot;&quot;'</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>settings.<span style="color: #660066;">readOnly</span> <span style="color: #339933;">?</span> <span style="color: #3366CC;">' disabled=&quot;disabled&quot;'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></pre>
<br />I have <a href="http://plugins.jquery.com/node/3365">reported this in the bugtracker</a> and I hope it will be included in the next release.]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/</feedburner:origLink></item>
		<item>
		<title>Making Clickable Images on CakePHP</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/YfwvyTq_Hj8/</link>
		<comments>http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 08:14:43 +0000</pubDate>
		<dc:creator>cyrose</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Helpers]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/</guid>
		<description><![CDATA[Hello again,Yesterday, i stumbled upon this problem on how am i suppose to create an image with a link on it. I needed to know it because of my goal. I wanted to use images as my buttons to navigate the admin pages. So without further ado, here&#8217;s how:1. We will use HTML Helpers Image [...]]]></description>
			<content:encoded><![CDATA[Hello again,<br /><br />Yesterday, i stumbled upon this problem on how am i suppose to create an image with a link on it. I needed to know it because of my goal. I wanted to use images as my buttons to navigate the admin pages. So without further ado, here&#8217;s how:<br /><br />1. We will use HTML Helpers Image and Link, and we shall combine this 2.<br /><br />2. For Image,<br /><br />Syntax:<br /><br />$html-&gt;image(string <em>$path</em>, array <em>$htmlAttributes</em>, boolean <em>$return = false);</em><br /><br />Example:<br /><br />$html-&gt;image(&#8217;/img/images/cancel.png&#8217;, array(&#8217;class&#8217; =&gt; &#8217;save_button&#8217;));<br /><br />3. For Link,<br /><br />Syntax:<br /><br />$html-&gt;link(string <em>$title, </em>string <em>$url, </em>array <em>$htmlAttributes, </em>string <em>$confirmMessage = false, </em>boolean <em>$escapeTitle = true, </em>boolean <em>$return = false</em>);<br /><br />Example:<br /><br />$html-&gt;link(&#8217;SAVE&#8217;, &#8216;/registers&#8217;, array(), false, false, false);<br /><br />4. So to make an image clickable,<br /><br />&lt;?php echo $html-&gt;link($html-&gt;image(&#8217;/img/images/cancel.png&#8217;,array(&#8217;class&#8217; =&gt; &#8217;save_button&#8217;)), &#8216;/registers&#8217;, array(), false, false, false); ?&gt;<br /><br />That&#8217;s it. I hope this will help you in the future.]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/</feedburner:origLink></item>
		<item>
		<title>Blog Redesign</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/Hddq4l4a2cc/</link>
		<comments>http://cakephp.prometsupport.com/2008/blog-redesign/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 11:30:06 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/blog-redesign/</guid>
		<description><![CDATA[I had some free time today and decided to redesign the blog. I just recently upgraded my browser to Firefox 3 since I heard it already became stable. The previous design was broken in FF3 and aside from that I have been longing to adjust the width and font size of this blog for readability. [...]]]></description>
			<content:encoded><![CDATA[I had some free time today and decided to redesign the blog. I just recently upgraded my browser to Firefox 3 since I heard it already became stable. The previous design was broken in FF3 and aside from that I have been longing to adjust the width and font size of this blog for readability. On top of that, <strong>PrometSource</strong>, previously known us Promet Solutions, <a href="http://www.prometsource.com">new website is UP</a>. We recently faced a transition in the company to better serve our clients. <br /><br />We are always looking for best possible ways for our readers to enjoy their stay. If you think we can make it look better, please feel free to add your comments below.]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/blog-redesign/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/blog-redesign/</feedburner:origLink></item>
		<item>
		<title>Setting Frontpage in CakePHP</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/vOgJ1Pwbe9s/</link>
		<comments>http://cakephp.prometsupport.com/2008/setting-frontpage-in-cakephp/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 01:21:12 +0000</pubDate>
		<dc:creator>cyrose</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[cakePHP websites]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/07/21/setting-frontpage-in-cakephp/</guid>
		<description><![CDATA[Hello again readers,I have another topic for newbies like me. I know this will help you. And this is very, very easy and it&#8217;s a common thing to do when developing websites. It&#8217;s establishing a homepage. Here&#8217;s how and this won&#8217;t take long.1. Code your desired design. This does not require you to complete the [...]]]></description>
			<content:encoded><![CDATA[Hello again readers,<br /><br />I have another topic for newbies like me. I know this will help you. And this is very, very easy and it&#8217;s a common thing to do when developing websites. It&#8217;s establishing a homepage. Here&#8217;s how and this won&#8217;t take long.<br /><br />1. Code your desired design. This does not require you to complete the entire html tags. Just the contents inside &lt;body&gt;&lt;/body&gt; would be fine.<br /><br />2. Then save it as home.ctp and upload to app/views/pages.<br /><br />And that&#8217;s it. You can now check your new homepage design.]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/setting-frontpage-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/setting-frontpage-in-cakephp/</feedburner:origLink></item>
		<item>
		<title>Setting Your Page Layout in CakePHP</title>
		<link>http://feedproxy.google.com/~r/PrometCakephpSource/~3/d7A901nHSY8/</link>
		<comments>http://cakephp.prometsupport.com/2008/setting-your-page-layout-in-cakephp/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 07:43:48 +0000</pubDate>
		<dc:creator>cyrose</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[cakePHP websites]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/07/21/setting-your-page-layout-in-cakephp/</guid>
		<description><![CDATA[I am not a pro in CakePHP, and in fact, i am just a beginner who wanted to explore it. When I was on my way to creating my goal, I stumbled upon a problem on how to change and then set the new page layout to be used. Honestly, the problem didn&#8217;t took me [...]]]></description>
			<content:encoded><![CDATA[I am not a pro in CakePHP, and in fact, i am just a beginner who wanted to explore it. When I was on my way to creating my goal, I stumbled upon a problem on how to change and then set the new page layout to be used. Honestly, the problem didn&#8217;t took me long to solve. I was lucky to have read the manual on the official site. So to cut the long story short, here is the list of steps which I did to come up with my new and first page layout on my CakePHP inspired website and you might consider following this little manual, too.<br /><br />1. First, design the layout that you wanted to implement and use. Assuming we have the simple code below as your desired page layout.<br />&lt;html&gt;<br />&lt;head&gt;<br />&lt;title&gt;&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br /><br />&lt;/body&gt;<br />&lt;/html&gt;<br /><br />2. After having established the base, let us now put the code that will show the title of your page. We will use $title_for_layout to do the job. So your head section will now look like this:<br />&lt;head&gt;<br />&lt;title&gt;&lt;?php echo $title_for_layout?&gt;&lt;/title&gt;<br />&lt;/head&gt;<br /><br />3. Next inline would be displaying the contents. We will use $content_for_layout. It will tell CakePHP where to place the code for your views. Our code now will look like this one.<br />&lt;html&gt;<br />&lt;head&gt;<br />&lt;title&gt;&lt;?php echo $title_for_layout?&gt;&lt;/title&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />&lt;?php echo $content_for_layout ?&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /><br />4. Then save it as app/views/layouts/default.ctp.<br /><br />Next topic would be creating and using multitle layouts for single website. Please feel free to share your views which you think can help us beginners make a step higher on CakePHP.]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/setting-your-page-layout-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://cakephp.prometsupport.com/2008/setting-your-page-layout-in-cakephp/</feedburner:origLink></item>
	</channel>
</rss>
