<?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>Kurinchi Blogger Scribbles ... &#187; cakePHP</title>
	<atom:link href="http://kurinchilamp.kurinchilion.com/tag/cakephp/feed" rel="self" type="application/rss+xml" />
	<link>http://kurinchilamp.kurinchilion.com</link>
	<description>On Open Source Technologies</description>
	<lastBuildDate>Mon, 02 Jan 2012 06:14:45 +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>How to include PEAR libraries with CakePHP?</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/10/how-to-include-pear-libraries-with-cakephp.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/10/how-to-include-pear-libraries-with-cakephp.html#comments</comments>
		<pubDate>Sat, 10 Oct 2009 08:29:49 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[include pear in cakephp]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[Pear library]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=696</guid>
		<description><![CDATA[Suggested solutions from other sites: 1) Modify /config/paths.php 2) Create separate php.ini settings file with the path to PEAR library 3) Modify the app_controller.php with the PEAR path settings My preference is to add the PEAR library to the &#8220;vendors&#8221; folder and to modify the app_controller to have the PEAR path included through it. if( [...]]]></description>
			<content:encoded><![CDATA[<p><em>Suggested solutions from other sites:</em><br />
1) Modify /config/paths.php<br />
2) Create separate php.ini settings file with the path to PEAR library<br />
3) Modify the app_controller.php with the PEAR path settings</p>
<p>My preference is to add the PEAR library to the &#8220;vendors&#8221; folder and to modify the app_controller to have the PEAR path included through it.</p>
<p><strong>if( file_exists(VENDORS.&#8217;Pear&#8217;)){<br />
    ini_set(&#8216;include_path&#8217;, ini_get(&#8216;include_path&#8217;) . PATH_SEPARATOR . PEAR);<br />
}</strong></p>
<p>Above solution suggested at <a href="https://trac.cakephp.org/ticket/263">CakePHP&#8217;s trac </a></p>
<p>Depending on the library that you want to get included in the programs, add the library to the respective view</p>
<p><strong>App::import(&#8216;vendor&#8217;, &#8216;XML_Feed_Parser&#8217;, array(&#8216;file&#8217; => &#8216;../vendors/pear/XML/Feed/Parser.php&#8217;));</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/10/how-to-include-pear-libraries-with-cakephp.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cakephp Deprecated: PHP 5.3 Wamp</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/09/cakephp-deprecated-php-5-3-wamp.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/09/cakephp-deprecated-php-5-3-wamp.html#comments</comments>
		<pubDate>Wed, 02 Sep 2009 03:02:28 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[deprecated]]></category>
		<category><![CDATA[php 5.3]]></category>
		<category><![CDATA[wamp server]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=658</guid>
		<description><![CDATA[Error message cakephp Deprecated: Assigning the return value of new by reference is deprecated You will see the above error message when you try to configure cakePHP framework using a Wamp Server installation and set the debug parameter as in Configure::write(&#8216;debug&#8217;, 2); Cause: CakePHP is not PHP 5.3 ready unlike the latest version of Zend [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Error message</strong><br />
<em>cakephp Deprecated: Assigning the return value of new by reference is deprecated</em><br />
You will see the above error message when you try to configure cakePHP framework using a Wamp Server installation and set the debug parameter as in </p>
<p><strong>Configure::write(&#8216;debug&#8217;, 2);</strong></p>
<p><strong>Cause</strong>: CakePHP is not PHP 5.3 ready unlike the latest version of Zend framework.</p>
<p><strong>Remedy</strong>: Try downloading older version of PHP &#8211; e.g. PHP 5.2.9</p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/09/cakephp-deprecated-php-5-3-wamp.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP &#8211; Bake Process</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/08/cakephp-bake-process.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/08/cakephp-bake-process.html#comments</comments>
		<pubDate>Tue, 11 Aug 2009 09:52:44 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[bake]]></category>
		<category><![CDATA[bake code]]></category>
		<category><![CDATA[bake php]]></category>
		<category><![CDATA[baking php]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[Fatal error: Class 'I18n' not found line 629]]></category>
		<category><![CDATA[models]]></category>
		<category><![CDATA[php framework]]></category>
		<category><![CDATA[simpletest]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=617</guid>
		<description><![CDATA[CakePHP Steps involved in Baking Scripts: i) Setup cakephp by ensuring that there is no warning message in the index page after initial installation. (for this you need to change salt value in /app/config/core.php, enable /app/config/database.php) ii) Create a database and a user for the database. After this apply the database configuration parameters to /app/config/database.php [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>CakePHP Steps involved in Baking Scripts:</em></strong></p>
<p>i) Setup cakephp by ensuring that there is no warning message in the index page after initial installation. (for this you need to change salt value in<strong> /app/config/core.php</strong>, enable<strong> /app/config/database.php</strong>)</p>
<p>ii) Create a database and a user for the database. After this apply the database configuration parameters to /app/config/database.php</p>
<p>If you are running the bake for the first time, it will ask you to create database configuration for the first time.</p>
<p>iii) Ensure that the path or the environment variable is set with access to PHP, MySQL executables</p>
<p><strong>c:/&gt; PATH or $ echo $PATH</strong><br />
<span id="more-617"></span></p>
<p>Go to the directory where you have unzipped the cake php location on the server</p>
<p><strong>c:\&gt; cd web\cake\console</strong></p>
<p><strong>c:\web\cake\console&gt; cake bake</strong></p>
<p>This will ask you the location where the application needs to be baked and the database configuration settings. If you set the verbose mode, it will ask you to create</p>
<p>If you want to get a menu based display to bake Controller, Views, Models, Database configuration you need to go to the &#8220;app&#8221; folder from where you need to give the bake command.</p>
<p>Note: You can add <strong>c:\web\cake\console</strong> to the PATH environment variable to reduce your typing</p>
<p>Or else, you need to issue the command</p>
<p><strong>c:\web\app&gt; c:\web\cake\console\cake bake</strong><br />
inorder for you to start baking.</p>
<p>Some times you may get into fatal errors when you do a cake bake especially with the development version. Do not panic. Just download the stable version to try out the bake functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/08/cakephp-bake-process.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Hardy Heron, CakePHP Setting in Virtual Host Environment</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/08/ubuntu-hardy-heron-cakephp-setting-in-virtual-host-environment.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/08/ubuntu-hardy-heron-cakephp-setting-in-virtual-host-environment.html#comments</comments>
		<pubDate>Wed, 05 Aug 2009 13:14:57 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[LINUX]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[hardy heron]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Virtual Host]]></category>
		<category><![CDATA[virtual hosting]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=577</guid>
		<description><![CDATA[If you are to setup CakePHP in a virtual hosting environment, we need to ensure that the DocumentRoot is setup correctly. Based on the experience I have had I thought to list down the virtual host setting and cakephp .htaccess setting files. root@myserver:/etc/apache2/conf.d# cat vhosts.conf NameVirtualHost 192.168.1.100:80 &#60;VirtualHost 192.168.1.100:80&#62; ServerName cakeapp DocumentRoot /var/www/cakeapp &#60;/VirtualHost&#62; (Note [...]]]></description>
			<content:encoded><![CDATA[<p>If you are to setup CakePHP in a virtual hosting environment, we need to ensure that the DocumentRoot is setup correctly. Based on the experience I have had I thought to list down the virtual host setting and cakephp .htaccess setting files.</p>
<p><strong>root@myserver:/etc/apache2/conf.d# cat vhosts.conf</strong><br />
NameVirtualHost 192.168.1.100:80</p>
<p>&lt;VirtualHost 192.168.1.100:80&gt;<br />
 ServerName cakeapp<br />
 DocumentRoot /var/www/cakeapp<br />
&lt;/VirtualHost&gt;</p>
<p>(Note that there is no ending forward slash after /var/www/cakeapp. If there had been one, it might cause a problem if the /var/www/cakeapp/app/config/routes.php is not configured correctly indicating a never ending loop in resolving domain name)</p>
<p><strong>root@myserver:/etc/apache2/conf.d# cat /var/www/cakeapp/.htaccess</strong><br />
&lt;IfModule mod_rewrite.c&gt;<br />
   RewriteEngine on<br />
   RewriteRule    ^$ app/webroot/    [L]<br />
   RewriteRule    (.*) app/webroot/$1 [L]<br />
&lt;/IfModule&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/08/ubuntu-hardy-heron-cakephp-setting-in-virtual-host-environment.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP: Multi-validatable Behavior</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/07/cakephp-multi-validatable-behavior.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/07/cakephp-multi-validatable-behavior.html#comments</comments>
		<pubDate>Tue, 21 Jul 2009 17:40:52 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[cakephp multiple validation]]></category>
		<category><![CDATA[multi-validatable]]></category>
		<category><![CDATA[multivalidatable]]></category>
		<category><![CDATA[multivalidatable behavior]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=512</guid>
		<description><![CDATA[Consider the following scenario where we have a database table:users and that we need carry the validations for the following forms i) Login ii) Change password iii) Add/Edit user records iv) Forgot password You can either write separate controllers and have each controller call a model based on table: users to validate each input field [...]]]></description>
			<content:encoded><![CDATA[<p>Consider the following scenario where we have a database table:users and that we need carry the validations for the following forms<br />
i) Login<br />
ii) Change password<br />
iii) Add/Edit user records<br />
iv) Forgot password </p>
<p>You can either write separate controllers and have each controller call a model based on <em>table: users </em>to validate each input field  or use the same user model to carry out different validations which sounds logical. </p>
<p>It is easy to carry out different validations in a cakephp model by using the <strong>Multi-validatable Behavior</strong> by having different validation sets for different testing conditions.</p>
<p><strong>Key things to note here &#8230;</strong></p>
<p>i) Download the code for <strong>Multivalidatable Behavior</strong> and have it placed under /models/behaviors/ folder</p>
<p>ii) In the model where you want to have multi validation, you need to include multivalidatable behavior like<br />
<strong>var $actsAs = array(&#8220;Multivalidatable&#8221;);</strong></p>
<p>iii) Add validation rulesets array like<br />
var $validationSets = array(&#8216;login&#8217; => array(&#8216;name&#8217;=>array(&#8216;rule&#8217;=>&#8217;alphanumeric&#8217;)),<br />
                                     &#8216;changepassword&#8217; => array(&#8216;password&#8217;=>array(&#8216;rule&#8217;=>&#8217;notEmpty&#8217;))<br />
);</p>
<p>iv) In the controller where you want to apply the validation rule set, you need to add the respective validation like</p>
<p>function login(){<br />
 $this->User->setValidation(&#8216;login&#8217;);<br />
}</p>
<p>function changepassword(){<br />
 $this->User->setValidation(&#8216;changepassword&#8217;);<br />
}</p>
<p>For more info visit <a href="http://bakery.cakephp.org/articles/view/multivalidatablebehavior-using-many-validation-rulesets-per-model" target="_blank">CakePHP Bakery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/07/cakephp-multi-validatable-behavior.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring CakePHP in localhost</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/07/configuring-cakephp-in-localhost.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/07/configuring-cakephp-in-localhost.html#comments</comments>
		<pubDate>Sun, 05 Jul 2009 23:57:10 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cakePHP]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=483</guid>
		<description><![CDATA[Quick and easy steps Grab a copy of cakePHP from cakephp.org website You can either create the new cakephp website in the root (http://localhost/) or by adding it as a subfolder (http://localhost/mycakesite/) If you create it as a subfolder, then configure the appropriate path settings for linking images in the web pages. Open /app/config.php and [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Quick and easy steps</strong></p>
<p>Grab a copy of cakePHP from <a href="http://cakephp.org/" target="_blank">cakephp.org</a> website</p>
<p>You can either create the new cakephp website in the root (http://localhost/) or by adding it as a subfolder (http://localhost/mycakesite/)</p>
<p>If you create it as a subfolder, then configure the appropriate path settings for linking images in the web pages.<br />
<span id="more-483"></span><br />
Open <strong>/app/config.php</strong> and make the following modifications<br />
- Modify the security salt value<br />
- to disable debug messages </p>
<p>Open <strong>/app/config/database.php.default </strong>and rename it to <strong>/app/config/database.php</strong>. If you wanted only one database, then make the necessary setting changes to default_database array by providing database name, host name, user name and password. And you can comment the variable declaration for the test database call if you it isn&#8217;t necessary. </p>
<p>The following steps may be of help to use if you are going to create MySQL database and configure a user with a password for that database:</p>
<p><strong>$ mysql -uroot -p</strong><br />
Enter the password.</p>
<p><strong>$ create database newdb;<br />
$ grant all on newdb.* to &#8216;newdbuser&#8217;@localhost identified by &#8216;newdbuser_password&#8217;;</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/07/configuring-cakephp-in-localhost.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cakePHP, codeIgniter: simple method to display array data</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-codeigniter-simple-method-to-display-array-data.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-codeigniter-simple-method-to-display-array-data.html#comments</comments>
		<pubDate>Mon, 15 Jun 2009 03:08:31 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[pre HTML tag]]></category>
		<category><![CDATA[print array data]]></category>
		<category><![CDATA[print_r]]></category>
		<category><![CDATA[var_dump]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=426</guid>
		<description><![CDATA[var_dump(), print_r() are commonly used functions to display data that is passed across controllers or views when playing in MVC frameworks. As the printed data stretches as a long string, it may be difficult to manipulate the resultset in most cases. When programming in CakePHP or CodeIgniter or other MVC frameworks when you do not [...]]]></description>
			<content:encoded><![CDATA[<p><strong>var_dump(), print_r() </strong>are commonly used functions to display data that is passed across controllers or views when playing in MVC frameworks. As the printed data stretches as a long string, it may be difficult to manipulate the resultset in most cases.</p>
<p>When programming in <strong>CakePHP or CodeIgniter </strong>or other <strong>MVC </strong>frameworks when you do not want to turn on the debugger routine and want to have a clean display of Array Data you can try adding a simple method in the Controller (appController in cakePHP) as follows<br />
<span id="more-426"></span></p>
<pre class="brush: php;">
function testdata($passed_data_array){

    echo "&lt;pre&gt;";
    print_r($passed_data_array);
    echo "&lt;/pre&gt;";

}
</pre>
<p>Usage of &#8220;<strong>pre</strong>&#8221; <strong>HTML </strong>tag preserves the spaces, line breaks and renders a neat display of array data.</p>
<p>You can also use var_dump instead of print_r depending on your need in the above method.</p>
<p><strong>CakePHP&#8217;s wrapper method: pr(mixed $var)</strong> is the equivalent of the above method.</p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-codeigniter-simple-method-to-display-array-data.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>cakePHP: Static page handling tips</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-static-page-handling-tips.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-static-page-handling-tips.html#comments</comments>
		<pubDate>Sat, 13 Jun 2009 02:01:55 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[page handling tips]]></category>
		<category><![CDATA[passing values to static pages]]></category>
		<category><![CDATA[static page]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=421</guid>
		<description><![CDATA[You can create static pages in cakePHP by adding .ctp files under /app/views/pages folder and can access it using the URI http://sitename/pages/pagename.ctp. Try creating two files page1.ctp and page2.ctp and add those files under /app/views/pages folder. page1.ctp &#60;h1&#62;Page 1&#60;/h1&#62; &#60;p&#62;Static Content for page 1 goes here&#60;/p&#62; page2.ctp &#60;h1&#62;Page 1&#60;/h1&#62; &#60;p&#62;Static Content for page 1 goes [...]]]></description>
			<content:encoded><![CDATA[<p>You can create static pages in cakePHP by adding .ctp files under /app/views/pages folder and can access it using the URI http://sitename/pages/pagename.ctp.</p>
<p>Try creating two files page1.ctp and page2.ctp and add those files under /app/views/pages folder.</p>
<p><strong>page1.ctp</strong></p>
<pre class="brush: php;">
&lt;h1&gt;Page 1&lt;/h1&gt;
&lt;p&gt;Static Content for page 1 goes here&lt;/p&gt;
</pre>
<p><strong>page2.ctp</strong></p>
<pre class="brush: php;">
&lt;h1&gt;Page 1&lt;/h1&gt;
&lt;p&gt;Static Content for page 1 goes here&lt;/p&gt;
</pre>
<p><span id="more-421"></span><br />
Depending on certain conditions, if you want to determine the layouts navigation panels or display/hide certain layers in the layout, you can do this by copying the pages_controller.php from /cake/libs/controller/pages_controller.php to /app/controllers/ and then modify the display() method by checking the value of the passed parameters.</p>
<pre class="brush: php;">
function display(){
......
......

$display_page = $this->params['pass'][0];
switch($display_page){
  case "page1":
        $this->layout('my_layout_1');
        break;
  case "page2":
        $this->layout('my_layout_2');
        break;
   .......
}
......
}
</pre>
<p>By copying the <strong>pages_controller.php </strong>to /app/controller/ directory you have the possibility to add some helpers through which you modify the output rendered to the <strong>static pages</strong>.</p>
<p>You can also handle it in the /app/app_controller.php (you need to move the app_controller.php file from /cake/libs/controller folder to /app/ folder).</p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-static-page-handling-tips.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cakePHP: Session enabled messages using Session-&gt;setFlash</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-session-enabled-messages-using-session-setflash.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-session-enabled-messages-using-session-setflash.html#comments</comments>
		<pubDate>Wed, 10 Jun 2009 03:28:37 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[UI, CSS]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[layouts]]></category>
		<category><![CDATA[Session messages]]></category>
		<category><![CDATA[Session SetFlash]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=410</guid>
		<description><![CDATA[There are different ways to flash or publish the messages for a user action. Usability plays a major role in determining how the navigation pattern for a web application takes place. publishing the outcome of user action on the same page designing a single page to flash all success, error, warning, notice level messages designing [...]]]></description>
			<content:encoded><![CDATA[<p>There are different ways to flash or publish the messages for a user action. Usability plays a major role in determining how the navigation pattern for a web application takes place.</p>
<ul>
<li>publishing the outcome of user action on the same page</li>
<li>designing a single page to flash all success, error, warning, notice level messages</li>
<li>designing a separate page for each message that gets published for the user</li>
</ul>
<p><span id="more-410"></span><br />
<strong>In CakePHP, to publish a message on the same page you need to make the following settings in the controller and view</strong></p>
<p><em>In the controller</em><br />
//app/controllers/posts_controller.php<br />
&lt;?php<br />
function add(){<br />
if ($this->Post->save($this->data)) {<br />
      $this->Session->setFlash(&#8216;Your post has been saved.&#8217;);<br />
      $this->redirect(&#8216;/posts&#8217;);<br />
   }<br />
}<br />
?&gt;</p>
<p><em>In the view</em></p>
<p>//app/views/posts/add.ctp<br />
&lt;?php<br />
   if ($session->check(&#8216;Message.flash&#8217;)){<br />
		 $session->flash();<br />
   }<br />
   echo $content_for_layout;<br />
?&gt;</p>
<p><strong>To design a single page to flash all success, error, warning, notice level messages follow the steps below</strong></p>
<p><em>In the controller</em><br />
//app/controllers/posts_controller.php<br />
&lt;?php<br />
function add(){<br />
if ($this->Post->save($this->data)) {<br />
      $this->Session->setFlash(&#8216;Your post has been saved.&#8217;, &#8216;general&#8217;);<br />
      $this->redirect(&#8216;/posts&#8217;);<br />
   }<br />
} //end of add<br />
?&gt;</p>
<p><em>In the view</em></p>
<p>//app/views/layouts/general.ctp<br />
&lt;?php<br />
   echo &#8220;Message :: &#8220;.$content_for_layout;<br />
?&gt;</p>
<p>To design a separate page for each message, it is the same as the above step.But instead of one template file, you will have separate file layout file in /app/views/layout like error.ctp, warning.ctp, notice.ctp and custom design these pages to show the respective messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-session-enabled-messages-using-session-setflash.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP: Parsing RSS feed in Simple Steps</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-parsing-rss-feed-in-simple-steps.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-parsing-rss-feed-in-simple-steps.html#comments</comments>
		<pubDate>Sat, 06 Jun 2009 03:18:13 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[read xml]]></category>
		<category><![CDATA[rss parser]]></category>
		<category><![CDATA[xml parser]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=396</guid>
		<description><![CDATA[How to read RSS feeds (XML file) and display contents in CakePHP? Parsing an XML feed can be done in simple steps as follows in CakePHP &#8230; CakePHP Controller: /app/controllers/rss_controller.php &#60;?php /** * CakePHP Controller to parse XML file */ class RssController extends AppController{ var $name = "Rss"; // As the RSS will not currently [...]]]></description>
			<content:encoded><![CDATA[<p><strong>How to read RSS feeds (XML file) and display contents in CakePHP?</strong></p>
<p>Parsing an XML feed can be done in simple steps as follows in CakePHP &#8230;</p>
<p><strong>CakePHP Controller: /app/controllers/rss_controller.php</strong></p>
<pre class="brush: php;">
&lt;?php
/**
*	CakePHP Controller to parse XML file
*/
class RssController extends AppController{
	var $name = "Rss";
	// As the RSS will not currently use a database
	var $uses = array();
	var $feed_url = "http://kurinchilamp.kurinchilion.com/feed";
	var $rss_item = array();

	function index(){
		App::import('Xml');
		$parsed_xml =&#038; new XML($this->feed_url);
		// xml to array conversion
		$this->rss_item = $parsed_xml->toArray();
		$this->set('data', $this->rss_item['Rss']['Channel']['Item']);
	}
}
?&gt;
</pre>
<p><strong>CakePHP View: /app/views/rss/index.ctp</strong></p>
<pre class="brush: php;">
<!--	CakePHP View to list RSS Feed title  -->
<ul>
<li>Feed Titles from kurinchilion.com</li>

&lt;?php
	foreach($data as $temp_item){
		echo "
<li><a href='".$temp_item['link']."' target='_blank'>".$temp_item['title']."</a></li>

";
	}
?&gt;
</ul>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/06/cakephp-parsing-rss-feed-in-simple-steps.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

