Re: Customise authError message class
Why not just specify the element you need as the second parameter then create an element for each message type - then you have complete control over layout, styling, classes and eventhing.? http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#SessionComponent::setFlash Jeremy Burns Class Outfit http://www.classoutfit.com On 12 Dec 2013, at 22:59, seba wrote: > Solved. Here's the working solution for reference- > > Code snippet in /Controller/AppController.php: > > public function beforeFilter() { > //Set custom authError message if user tries to access a controller when > not logged in > $this->Auth->authError = __('You are not authorized to view this page.'); > $this->Auth->flash['params']['class'] = 'alert alert-danger'; //Add this > line to control output auth flash class > } > > On Thursday, 12 December 2013 23:46:39 UTC+11, seba wrote: > I'm looking for advice on how to customize the authError message class (I'm > using Twitter Bootstrap, so would like to use the alert styles from > Bootstrap). > > In /Controller/AppController.php I have the following snippet: > > public function beforeFilter() { > //Set custom authError message if user tries to access a controller when > not logged in > $this->Auth->authError = __('You are not authorized to view this page.'); > } > Which produces this HTML (class="message": > > You are not authorized to view this > page. > > What I'd like to output is this HTML (class="alert alert-danger"): > You are not authorized to > view this page. > > Much thanks in advance. > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Customise authError message class
Solved. Here's the working solution for reference- Code snippet in /Controller/AppController.php: public function beforeFilter() { //Set custom authError message if user tries to access a controller when not logged in $this->Auth->authError = __('You are not authorized to view this page.'); $this->Auth->flash['params']['class'] = 'alert alert-danger'; //Add this line to control output auth flash class } On Thursday, 12 December 2013 23:46:39 UTC+11, seba wrote: > > I'm looking for advice on how to customize the authError message class > (I'm using Twitter Bootstrap, so would like to use the alert styles from > Bootstrap). > > In /Controller/AppController.php I have the following snippet: > > public function beforeFilter() { > //Set custom authError message if user tries to access a controller when > not logged in > $this->Auth->authError = __('You are not authorized to view this page.'); > } > > Which produces this HTML (class="message": > > You are not authorized to view > this page. > > > What I'd like to output is this HTML (class="alert alert-danger"): > > You are not authorized > to view this page. > > > Much thanks in advance. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Customise authError message class
I'm looking for advice on how to customize the authError message class (I'm using Twitter Bootstrap, so would like to use the alert styles from Bootstrap). In /Controller/AppController.php I have the following snippet: public function beforeFilter() { //Set custom authError message if user tries to access a controller when not logged in $this->Auth->authError = __('You are not authorized to view this page.'); } Which produces this HTML (class="message": You are not authorized to view this page. What I'd like to output is this HTML (class="alert alert-danger"): You are not authorized to view this page. Much thanks in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.