Auth Flash params对我不起作用。
AppController的: class AppController扩展了Controller {
public $helpers = array(
'Session',
'Facebook.Facebook',
'Html' => array('className' => 'BoostCake.BoostCakeHtml'),
'Form' => array('className' => 'BoostCake.BoostCakeForm'),
'Paginator' => array('className' => 'BoostCake.BoostCakePaginator'),
'AssetCompress.AssetCompress',
'PhpThumb.PhpThumb'
);
public $components = array(
'Session',
'RequestHandler',
'Auth' => array(
'authenticate' => array('Custom'),
'loginRedirect' => array('controller' => 'users', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'pages', 'action' => 'index'),
'flash' => array(
'element' => 'alert',
'key' => 'auth',
'params' => array(
'plugin' => 'BoostCake',
'class' => 'alert-danger'
)
)
),
);
默认布局: 会话级>闪速(); echo $ this-> Session-> flash('auth');
echo $this->fetch('content');
?>
我调试了params以确保它们输出正确,但是当弹出警报时,这就是我所看到的:
<div id="authMessage" class="message">Username or password is incorrect</div>
提前致谢
答案 0 :(得分:0)
您需要在视图中创建名为alert.ctp的ctp,如下所示:
<div id="authMessage" class="message">
<?php
echo $plugin;
echo $class;
?>
Username or password is incorrect
</div>