2011-07-27 37 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技能 - 如此忍受我!謝謝!

+0

在佈局(或視圖)中是否有'echo $ this-> Session-> flash();'? –

+0

@mattb echo $ this-> Session-> flash('auth');坐在佈局。 – Plastika

回答

0

添加另一條線下方

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

像這樣:

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

這將顯示正常閃光消息

,把「權威性」到閃蒸法將只顯示身份驗證提示信息和沒有其他的。有關更多信息,請參閱http://api13.cakephp.org/class/session-helper#method-SessionHelperflash

+0

我簡直不敢相信那是那麼簡單 - 我靠近控制器拉扯頭髮。非常感謝! – Plastika

+0

任何時候,很高興我可以幫助:-) –