Re: Custom flash messages

2010-04-07 Thread WebbedIT
I know this is an extreme case due to the tiny nature of the 3 HTML layouts involved, but ideally one should be looking to use just one template and apply visual changes, including icons and jQuery effects, based on CSS IDs and Classes if possible. But how much time this saves in this example is q

Re: Custom flash messages

2010-04-06 Thread jacmoe
It's pretty simple, really: echo $this->Session->setFlash('Some Error.', 'flash_error'); echo $this->Session->setFlash('Some Success.', 'flash_success'); echo $this->Session->setFlash('Some Notice.', 'flash_notice'); And so on. My success message is using jQuery to fade away, but my notice stays u

Re: Custom flash messages

2010-04-06 Thread WebbedIT
Is that not over simplified? How do you specify from the controller an update message as opposed to an error or warning notice? Surely all such messages share very the same code and just need a class change to alter the colour and icon used so having multiple templates seems a little OTT. Check

Re: Custom flash messages

2010-04-03 Thread jacmoe
I use a much simpler approach: echo $this->Session->setFlash('Some Error.', 'flash_error'); Then in views/elements/flash_error.ctp: It works wonderfully. :) I can style those layouts using CSS and jQuery, whatever. I just put the style in the layout, instead of specifying it.

Re: Custom flash messages

2010-04-03 Thread WebbedIT
The second parameter (string) tells the flash method which layout to use Session::setFlash(message[string:optional], layout[string:optional], options[array:optional], key[string:optional]) http://api.cakephp.org/class/session-component#method-SessionComponentsetFlash HTH Paul. Check out the ne

Re: Custom flash messages

2010-04-02 Thread Ed Propsner
I understand what __() is being used for but would not have thought to write is as [code] $this->Session->setFlash(__(' Some Flash message here'),'default',array('class' => 'flash_failure')); [/code] it makes more sense now. By the way ... what is 'default' specifying in the setFlash ? On F

Re: Custom flash messages

2010-04-02 Thread LunarDraco
In your first post it looks like you may have had the closing ')' in the wrong place, and the array was being passed as a second parameter to the __() function and was never getting to the setFlash function. You had: $this->Session->setFlash(__(' Some Flash message here ',array('class' => 'flash_fa

Re: Custom flash messages

2010-04-02 Thread Ed Propsner
It works now but I'm not sure what I was doing wrong ... I don't even know what I did to fix it. I was using this so set my message [code] $this->Session->setFlash(' Some message here ', 'default', array('class' => 'flash_failure')); [/code] The CSS was simple enough as well[code].flash

Re: Custom flash messages

2010-04-02 Thread cricket
Maybe your CSS selector needs to be adjuted. Do you have firebug installed? Easy enough to check with that, whether it's the CSS or the div isn't getting the class name. On Apr 2, 11:22 am, Ed Propsner wrote: > Seems straightforward enough but I must be overlooking something somewhere. > Still no

Re: Custom flash messages

2010-04-02 Thread jacmoe
I think you need to show us some of that code of yours. :) On Apr 2, 5:22 pm, Ed Propsner wrote: > Seems straightforward enough but I must be overlooking something somewhere. > Still not working out for me. > > On Fri, Apr 2, 2010 at 6:22 AM, WebbedIT wrote: > > I use: > > > $this->Session->setF

Re: Custom flash messages

2010-04-02 Thread Ed Propsner
Seems straightforward enough but I must be overlooking something somewhere. Still not working out for me. On Fri, Apr 2, 2010 at 6:22 AM, WebbedIT wrote: > I use: > > $this->Session->setFlash('Whatever message I want to display', > 'default', array('class'=>'message update')); > > And I change t

Re: Custom flash messages

2010-04-02 Thread WebbedIT
I use: $this->Session->setFlash('Whatever message I want to display', 'default', array('class'=>'message update')); And I change the update class to notice or error depending on what info I am displaying. My CSS is as follows div.message {-moz-border-radius:5px; padding:6px 10px; margin:10px 0;

Re: Custom flash messages

2010-04-01 Thread cricket
This is how I use flash() AppController: public function flash($msg, $url = null, $layout = null) { $this->Session->setFlash($msg, (is_null($layout) ? 'flash_msg' : $layout)); if (!is_null($url)) { $this->redirect($url); exit(0); } }

Custom flash messages

2010-03-31 Thread Ed Propsner
I've been playing around trying to customize my flash messages with CSS and I'm having a bit of trouble. I tried to define the class with the message itself [code]$this->Session->setFlash(__(' Some Flash message here ', array('class' => 'flash_failure')));[/code] I also tried to us