<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Session-Based Flash Messages Look Better (CakePHP)</title>
	<atom:link href="http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/</link>
	<description>I break it. I fix it. You learn.</description>
	<lastBuildDate>Wed, 11 Aug 2010 03:59:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: headbiznatch</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-231</link>
		<dc:creator>headbiznatch</dc:creator>
		<pubDate>Wed, 10 Sep 2008 07:46:23 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-231</guid>
		<description>&lt;pre&gt;
&lt;code&gt;
check(&#039;Message.flash&#039;)): echo &#039;onload=&quot;$.prompt(\&#039;&#039;; $session-&gt;flash(); echo &#039;\&#039;);&quot;&#039;; endif; ?&gt;;
&lt;/code&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>
<code>
check('Message.flash')): echo 'onload="$.prompt(\''; $session->flash(); echo '\');"'; endif; ?>;
</code>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: headbiznatch</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-229</link>
		<dc:creator>headbiznatch</dc:creator>
		<pubDate>Wed, 10 Sep 2008 07:41:50 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-229</guid>
		<description>useful tidbit here - thank you.

i played around with Impromptu, a nifty jQuery extension, and got a nice modal message box that i put in my default.ctp attached to the body onload. funky. here&#039;s the link to impromptu:

http://trentrichardson.com/Impromptu/index.php

and here is the snippet i put in my template before the closing &quot;&gt;&quot; of the body tag:

check(&#039;Message.flash&#039;)): echo &#039;onload=&quot;$.prompt(\&#039;&#039;; $session-&gt;flash(); echo &#039;\&#039;);&quot;&#039;; endif; ?&gt;

rock.</description>
		<content:encoded><![CDATA[<p>useful tidbit here &#8211; thank you.</p>
<p>i played around with Impromptu, a nifty jQuery extension, and got a nice modal message box that i put in my default.ctp attached to the body onload. funky. here&#8217;s the link to impromptu:</p>
<p><a href="http://trentrichardson.com/Impromptu/index.php" rel="nofollow">http://trentrichardson.com/Impromptu/index.php</a></p>
<p>and here is the snippet i put in my template before the closing &#8220;&gt;&#8221; of the body tag:</p>
<p>check(&#8216;Message.flash&#8217;)): echo &#8216;onload=&#8221;$.prompt(\&#8221;; $session-&gt;flash(); echo &#8216;\&#8217;);&#8221;&#8216;; endif; ?&gt;</p>
<p>rock.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-182</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Wed, 16 Jul 2008 10:50:16 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-182</guid>
		<description>I did find your posting very useful, although i created my own helper class &quot;Flash&quot; for this one.
This was needed, because CakePHP is not able to put more then 1 Message of each category (error, success etc) in the SESSION.

So if your app throws a second error somewhere, the first one will be deleted silently, which is really a problem at some points!

I put them in an array, and therefore can store multiple ones, which are (by the helper) read out and displayed.

Next thing i wanna build in, is a sorted display. Not random, but in the order of importance: Error -&gt; Warning -&gt; Success -&gt; Info</description>
		<content:encoded><![CDATA[<p>I did find your posting very useful, although i created my own helper class &#8220;Flash&#8221; for this one.<br />
This was needed, because CakePHP is not able to put more then 1 Message of each category (error, success etc) in the SESSION.</p>
<p>So if your app throws a second error somewhere, the first one will be deleted silently, which is really a problem at some points!</p>
<p>I put them in an array, and therefore can store multiple ones, which are (by the helper) read out and displayed.</p>
<p>Next thing i wanna build in, is a sorted display. Not random, but in the order of importance: Error -&gt; Warning -&gt; Success -&gt; Info</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deltawing1</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-178</link>
		<dc:creator>deltawing1</dc:creator>
		<pubDate>Sat, 05 Jul 2008 04:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-178</guid>
		<description>Thanks for this tutorial!

Oh and thank you Djize! I&#039;ve been needing exactly that technique :-) 
The elegant and &quot;correct&quot; way to do it.</description>
		<content:encoded><![CDATA[<p>Thanks for this tutorial!</p>
<p>Oh and thank you Djize! I&#8217;ve been needing exactly that technique :-)<br />
The elegant and &#8220;correct&#8221; way to do it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Koa</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-174</link>
		<dc:creator>Koa</dc:creator>
		<pubDate>Tue, 24 Jun 2008 15:59:40 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-174</guid>
		<description>&lt;strong&gt;connector&lt;/strong&gt;, I&#039;m using &lt;a href=&quot;http://tinymce.moxiecode.com/&quot; rel=&quot;nofollow&quot;&gt;TinyMCE&lt;/a&gt; as the WYSIWYG editor. Enjoy!</description>
		<content:encoded><![CDATA[<p><strong>connector</strong>, I&#8217;m using <a href="http://tinymce.moxiecode.com/" rel="nofollow">TinyMCE</a> as the WYSIWYG editor. Enjoy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: connector</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-173</link>
		<dc:creator>connector</dc:creator>
		<pubDate>Tue, 24 Jun 2008 07:20:46 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-173</guid>
		<description>Thanks for the nice tutorial. One question, can you tell my what wysiwy editor you used in the screenshots? Thanks!</description>
		<content:encoded><![CDATA[<p>Thanks for the nice tutorial. One question, can you tell my what wysiwy editor you used in the screenshots? Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonah</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-172</link>
		<dc:creator>Jonah</dc:creator>
		<pubDate>Mon, 23 Jun 2008 01:41:32 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-172</guid>
		<description>Thanks for the article and the comment from Djiize.  I now know how to use the Session-&gt;setFlash() funtion!</description>
		<content:encoded><![CDATA[<p>Thanks for the article and the comment from Djiize.  I now know how to use the Session-&gt;setFlash() funtion!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KurtQian&#8217;s blog - Flash messages</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-165</link>
		<dc:creator>KurtQian&#8217;s blog - Flash messages</dc:creator>
		<pubDate>Thu, 12 Jun 2008 06:22:01 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-165</guid>
		<description>[...] CakePHP (from http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/): [...]</description>
		<content:encoded><![CDATA[<p>[...] CakePHP (from <a href="http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/" rel="nofollow">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/</a>): [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Djiize</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-83</link>
		<dc:creator>Djiize</dc:creator>
		<pubDate>Wed, 23 Jan 2008 09:52:37 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-83</guid>
		<description>@leveille: or you can use the 2nd param of setFlash to specify a layout $this-&gt;Session-&gt;setFlash(&#039;bad values&#039;, &#039;flash_err&#039;)
then create your layouts: flash_err.ctp, flash_warn.ctp, flash_succ.ctp
and just call $session-&gt;flash() in you default layout
Leave boring work to Cake, it exists for that ;)</description>
		<content:encoded><![CDATA[<p>@leveille: or you can use the 2nd param of setFlash to specify a layout $this-&gt;Session-&gt;setFlash(&#8216;bad values&#8217;, &#8216;flash_err&#8217;)<br />
then create your layouts: flash_err.ctp, flash_warn.ctp, flash_succ.ctp<br />
and just call $session-&gt;flash() in you default layout<br />
Leave boring work to Cake, it exists for that ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leveille</title>
		<link>http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/comment-page-1/#comment-71</link>
		<dc:creator>leveille</dc:creator>
		<pubDate>Sun, 20 Jan 2008 19:38:56 +0000</pubDate>
		<guid isPermaLink="false">http://labs.iamkoa.net/2008/01/13/session-based-flash-messages-look-better-cakephp/#comment-71</guid>
		<description>I agree with your assessment that the use of the intermediate flash page intrudes into the normal application flow.  I implement a technique whereby I create a flash element, and render this flash element at the top of my template.
&lt;pre&gt;
&lt;code&gt;
element(&#039;flash&#039;);
&lt;/code&gt;
&lt;/pre&gt;

The flash element consists of code to check whether or not the message being sent is an error, warning, or success:
&lt;pre&gt;
&lt;code&gt;
   check(&#039;Message.err&#039;))
      {
         echo &#039;&#039;;
         $session-&gt;flash(&#039;err&#039;);
         echo &#039;&#039;;
      }

   check(&#039;Message.warn&#039;))
      {
         echo &#039;&#039;;
         $session-&gt;flash(&#039;warn&#039;);
         echo &#039;&#039;;
      }

   check(&#039;Message.succ&#039;))
      {
         echo &#039;&#039;;
         $session-&gt;flash(&#039;succ&#039;);
         echo &#039;&#039;;
      }
&lt;/code&gt;
&lt;/pre&gt;

I also make use of these div&#039;s for javascript feedback, which is why I don&#039;t programmatically display the actual div/class.  They&#039;re always ready to be injected with user feedback.  The p tags on the other hand are displayed when appropriate, as those are what get styled via css.

In my controller I set the type of flash message and redirect to the appropriate location:

&lt;pre&gt;
&lt;code&gt;
$this-&gt;Session-&gt;setFlash(&#039;The lesson you have selected is unavailable or invalid.  Please try again.&#039;, null, null, &#039;err&#039;);
$this-&gt;redirect(array(&#039;action&#039;=&gt;&#039;index&#039;));
&lt;/code&gt;
&lt;/pre&gt;
Just thought I would share.  This technique may or may not be helpful to others.</description>
		<content:encoded><![CDATA[<p>I agree with your assessment that the use of the intermediate flash page intrudes into the normal application flow.  I implement a technique whereby I create a flash element, and render this flash element at the top of my template.</p>
<pre>
<code>
element('flash');
</code>
</pre>
<p>The flash element consists of code to check whether or not the message being sent is an error, warning, or success:</p>
<pre>
<code>
   check('Message.err'))
      {
         echo '';
         $session->flash('err');
         echo '';
      }

   check('Message.warn'))
      {
         echo '';
         $session->flash('warn');
         echo '';
      }

   check('Message.succ'))
      {
         echo '';
         $session->flash('succ');
         echo '';
      }
</code>
</pre>
<p>I also make use of these div&#8217;s for javascript feedback, which is why I don&#8217;t programmatically display the actual div/class.  They&#8217;re always ready to be injected with user feedback.  The p tags on the other hand are displayed when appropriate, as those are what get styled via css.</p>
<p>In my controller I set the type of flash message and redirect to the appropriate location:</p>
<pre>
<code>
$this->Session->setFlash('The lesson you have selected is unavailable or invalid.  Please try again.', null, null, 'err');
$this->redirect(array('action'=>'index'));
</code>
</pre>
<p>Just thought I would share.  This technique may or may not be helpful to others.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

