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
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
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
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.
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
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
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
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
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
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
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
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;
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);
}
}
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
14 matches
Mail list logo