Since you were saying "Javascript alert box", I guess this wouldn't be
a CakePHP specific question.
Anyway, let me answer (using jQuery, of course)
1.) Set aside a div (or any container you deem fit) on your layout to
contain the $session->flash('auth') message. Place an ID for this div.
2.) Style this div like display: hidden
3.) On jQuery document.ready, get the contents of this div, and put it
in an alert box as you would in normal Javascript.
Cheers,
OJ
On Nov 9, 4:47 am, Marcelo Andrade <mfandr...@gmail.com> wrote:
On Mon, Nov 9, 2009 at 10:29 PM, O.J. Tibi <ojt...@gmail.com> wrote:
> Hi Marcelo,
> Since you were saying "Javascript alert box", I guess this wouldn't be
> a CakePHP specific question.
> Anyway, let me answer (using jQuery, of course)
> 1.) Set aside a div (or any container you deem fit) on your layout to
> contain the $session->flash('auth') message. Place an ID for this div.
> 2.) Style this div like display: hidden
> 3.) On jQuery document.ready, get the contents of this div, and put it
> in an alert box as you would in normal Javascript.
> Cheers,
> OJ
Thanks OJ. In fac I was not clear, but it was a CakePHP specific
question. I didn't like to use $this->Session->setFlash to output
a welcome message when user logs in, bug just a javascript alert.
But your answer was insightful. I'm settings a variable to the view
in the UsersController's login method, so I can check it in my view.
It works, besides it's not not the most elegant solution. :-}
Best regards.
--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105