BlueDolphin
BlueDolphin

Reputation: 9765

Undefined variable error when reference yii controller defined public variable in view

In yii framework helloworld, I defined a variable in controller class

class MessageController extends Controller
{
        public $time = 'ok';

Supposely I could reference the variable $time in relevant view class using $this->$time.

But I am seeing variable undefined error.

Anything I might be missing.

Thanks.

Upvotes: 0

Views: 1226

Answers (1)

Renato S. Martins
Renato S. Martins

Reputation: 223

You have a typo... I guess you mean $this->time (without the $ in time).

Upvotes: 3

Related Questions