L
L
Looking2014-05-07 13:05:20
Yii
Looking, 2014-05-07 13:05:20

How to render in layouts (yii)?

public function actionIndex()
  {
    // renders the view file 'protected/views/site/index.php'
    // using the default layout 'protected/views/layouts/main.php'
    $this->render('/layouts/main', array (
        'catProvider' => Cat::model() -> loadCat(),
        //'News' => News::model() -> loadLastNews(),
      ));
  }

Why doesn't this option work?
Call to a member function getData() on a non-object in ....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Papa, 2014-05-07
Stifflera @PapaStifflera

because

...
Cat::model() -> loadCat()
...

does not return a CDataProvider object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question