2011-07-27 15 views
0

私は確信しています。関数自体は何を求めているのですが、メッセージは実行されてもフラッシュされません。以下cakephpでメッセージが点滅しない編集機能

機能:

function edit($id = null) { 
      if($this->Auth->user('id')==$id) { 
       $this->set('user', $this->User->read(null, $id)); 
       } else { 
        $this->Session->setFlash(__('You are not authorized to edit other member profiles', true)); 
        $this->redirect(array('action' => 'index')); 
     } 
     if (!empty($this->data)) { 
      if ($this->User->save($this->data)) { 
       $this->Session->setFlash(__('Member profile saved', true)); 
       $this->redirect(array('action' => 'index')); 
      } else { 
       $this->Session->setFlash(__('Member profile could not be saved. Please, try again.', true)); 
      } 
     } 
     if (empty($this->data)) { 
      $this->data = $this->User->read(null, $id); 
     } 
     $groups = $this->User->Group->find('list'); 
     $this->set(compact('groups')); 
    } 

はまだCakePHPのロープを学習し、いくつかの非常に古いPHPのスキルをキンドリング - ので、私と一緒にクマ!ありがとう!

echo $this->Session->flash(); 

これが唯一の認証フラッシュメッセージが表示されますフラッシュ法に 'AUTH' を渡し、通常のフラッシュメッセージ

を表示します:

+0

あなたは 'エコーの$ this - >セッション - >フラッシュ()を持っています;'レイアウト(またはビュー)で? –

+0

@mattb echo $ this-> Session-> flash( 'auth');レイアウトに座っている。 – Plastika

答えて

0

このよう

echo $this->Session->flash('auth'); 

の下に別の行を追加します。他には何もない。詳細については、http://api13.cakephp.org/class/session-helper#method-SessionHelperflashを参照してください。

+0

それはそれほどシンプルなものだったとは思えません。コントローラーで髪を引っ張り出すほど近くにいました。 – Plastika

+0

いつでも、私は助けてくれるとうれしいです:-) –

関連する問題