Monday, September 24, 2012

Re: Session check problem

thanks Andras,... it works,... but I'm running into some other problems,.... with UserHelper.php etc,... 
the problem is I need to display signin content and not signin content for user. and I have this working on old version of CAKE,... probably the very first version,... PREBETA version ;) 

what I have on view file is: 

    <?php if($user->is_user()): ?>
SIGNIN CONTENT 
<?php else: ?>
NOT SIGNIN CONTENT 
<?php endif ?>

but I'm getting an error: 
Undefined variable: user [APP/View/Home/index.ctp, line 2]

I think this has something to do with UserHelper.php ,... isn't it? 

  class UserHelper extends Helper  {	    var $user = null;      function UserHelper()    {      $this->user = $this->read('user');    }      function is_user()    {      return isset($this->user);    }    
..... 

I appreciate your help,... in advance 
mucho thanks 



On Sunday, September 23, 2012 3:24:50 PM UTC-7, Andras Kende wrote:
try to add 'Session' to your components…

public $components = array('Session', 'Cookie', 'RequestHandler');

Andras Kende



On Sep 23, 2012, at 2:55 PM, Chris <chri...@yahoo.com> wrote:

hi guys,... 
having a problem to migrate to a new version 2.2.2 
in AppController I have: 

App::uses('Controller', 'Controller', 'CakeEmail', 'Network/Email');
class AppController extends Controller {
  
  static $FLASH_ALLOWED_TYPES = array('error', 'valid', 'notice');

  var $helpers = array('Javascript', 'Ajax', 'User', 'Session', 'App'); 
  var $components = array('Cookie', 'RequestHandler');


  function beforeFilter()
  {

    if($this->Session->check('user'))
      $this->user = $this->Session->read('user');

and it gives me an error 
Fatal error: Call to a member function check() on a non-object in /home/xachkaa/hamayk.com/html/app/Controller/AppController.php on line 139 

can anybody tells me what's wrong with it please ... 

thanks 

  

--
Like Us on FacekBook 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 post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FacekBook 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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: