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.
asked Nov 21, 2014 at 10:00
-
possible duplicate of Increasing nesting functions calls limitrjdown– rjdown11/21/2014 10:21:29Commented Nov 21, 2014 at 10:21
2 Answers 2
If that is indeed code from "_form.php", then the following code is recursively rendering _form.php inside itself:
<?= $this->render('_form', [
'model' => $model,
]) ?>
answered Nov 22, 2014 at 14:35
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,
]) ?>
lang-php