CakePHP自定义flash的loginError [英] CakePHP custom flash for loginError

查看:126
本文介绍了CakePHP自定义flash的loginError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的错误:

<?php
    $this->Auth->loginError = "No, you fool!  That's not the right password!";
?>

但我有一个自定义flash元素。如何使用?

But I have a custom flash element. How do I use that? and how I pass in extra information like in the below example.

示例flash:

$this->Session->setFlash('Your settings have been updated', 'flash', array('myclass' => 'success'));

自定义flash元素:

Custom flash element:

<div id="flashMessage" class="message<?php if(isset($myclass)) { echo ' ' . $myclass; } ?>">
 <div class="content">
   <?php if(isset($header)) { echo '<h3>' . $header . '</h3>'; } ?>
   <p><?php echo $message; ?></p>
 </div>
</div>


推荐答案

这可能很旧,但我有一个类似的问题,并通过将布局分配给AuthComponent成员字段 flashElement 来解决它;

This may be old, but I had a similar problem, and solved it by assigning the layout to the AuthComponent member field flashElement;

$this->Auth->flashElement = 'custom_flash';

查看 customn auth flash。

这篇关于CakePHP自定义flash的loginError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆