1

In _form.php I am trying to use this simple code and I am getting the error:

<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\State;



/* @var $this yii\web\View */
/* @var $model app\models\State */
/* @var $form yii\widgets\ActiveForm */

 $model = new State();
?>



<?= $this->render('_form', [
        'model' => $model,
        ]) ?>

Why I am getting this error. As the same code was working fine.

Pawan
  • 3,864
  • 17
  • 50
  • 83
  • possible duplicate of [Increasing nesting functions calls limit](http://stackoverflow.com/questions/4293775/increasing-nesting-functions-calls-limit) – rjdown Nov 21 '14 at 10:21

2 Answers2

3

If that is indeed code from "_form.php", then the following code is recursively rendering _form.php inside itself:

<?= $this->render('_form', [
        'model' => $model,
        ]) ?>
Joshi
  • 2,730
  • 5
  • 36
  • 62
0

Joshi is correct, and the reason it's happening is because that you're calling render() instead of renderPartial(). Change your code to this, and the error will disappear and your partial will show as expected:

<?= $this->renderPartial('_form', [
        'model' => $model,
    ]) ?>